Зміст курсу
R Introduction: Part II
R Introduction: Part II
Namings
In the previous chapter, you saw that list output contains indices within double square brackets. That's good, but wouldn't it be better if we had names instead of indices? Indeed, it would.
There are two ways to set names on list elements. The first is used in the process of list creation. Within list()
function use name = values
equalities (name should be used without quotes). For example, let's rewrite the previous example with names.
That's much better! The second way is to set names for the already created list. Assign a vector of names to names(list)
function. For example,
Завдання
Given the list info
from the previous chapter. Using the second method (names()
function), assign the following names to elements: 'Course name', 'Section', 'Chapter', 'Chapter overall'
. Output the list, then.
Завдання
Given the list info
from the previous chapter. Using the second method (names()
function), assign the following names to elements: 'Course name', 'Section', 'Chapter', 'Chapter overall'
. Output the list, then.
Все було зрозуміло?
Namings
In the previous chapter, you saw that list output contains indices within double square brackets. That's good, but wouldn't it be better if we had names instead of indices? Indeed, it would.
There are two ways to set names on list elements. The first is used in the process of list creation. Within list()
function use name = values
equalities (name should be used without quotes). For example, let's rewrite the previous example with names.
That's much better! The second way is to set names for the already created list. Assign a vector of names to names(list)
function. For example,
Завдання
Given the list info
from the previous chapter. Using the second method (names()
function), assign the following names to elements: 'Course name', 'Section', 'Chapter', 'Chapter overall'
. Output the list, then.
Завдання
Given the list info
from the previous chapter. Using the second method (names()
function), assign the following names to elements: 'Course name', 'Section', 'Chapter', 'Chapter overall'
. Output the list, then.
Все було зрозуміло?
In the previous chapter, you saw that list output contains indices within double square brackets. That's good, but wouldn't it be better if we had names instead of indices? Indeed, it would.
There are two ways to set names on list elements. The first is used in the process of list creation. Within list()
function use name = values
equalities (name should be used without quotes). For example, let's rewrite the previous example with names.
That's much better! The second way is to set names for the already created list. Assign a vector of names to names(list)
function. For example,
Завдання
Given the list info
from the previous chapter. Using the second method (names()
function), assign the following names to elements: 'Course name', 'Section', 'Chapter', 'Chapter overall'
. Output the list, then.
Namings
In the previous chapter, you saw that list output contains indices within double square brackets. That's good, but wouldn't it be better if we had names instead of indices? Indeed, it would.
There are two ways to set names on list elements. The first is used in the process of list creation. Within list()
function use name = values
equalities (name should be used without quotes). For example, let's rewrite the previous example with names.
That's much better! The second way is to set names for the already created list. Assign a vector of names to names(list)
function. For example,
Завдання
Given the list info
from the previous chapter. Using the second method (names()
function), assign the following names to elements: 'Course name', 'Section', 'Chapter', 'Chapter overall'
. Output the list, then.