Зміст курсу
Вступ до R: Частина 1
Вступ до R: Частина 1
Видалення Елементів
Оскільки ви навчились додавати елементи до вектора, логічно також навчитися їх видаляти. Все йде до цього.
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the third element grades[-3]
Similarly, to eliminate the second and fourth elements from the initial grades
vector, you would proceed as follows:
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the second and fourth elements grades[-c(2,4)]
Swipe to show code editor
From the previous task, you have the prices
vector with the prices of 6 items. Your task is:
- Remove the
'Dining chair'
item from theprices
vector. This item is the fourth in the vector. Save the changes by reassignment. - Display the modified
prices
vector.
Дякуємо за ваш відгук!
Видалення Елементів
Оскільки ви навчились додавати елементи до вектора, логічно також навчитися їх видаляти. Все йде до цього.
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the third element grades[-3]
Similarly, to eliminate the second and fourth elements from the initial grades
vector, you would proceed as follows:
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the second and fourth elements grades[-c(2,4)]
Swipe to show code editor
From the previous task, you have the prices
vector with the prices of 6 items. Your task is:
- Remove the
'Dining chair'
item from theprices
vector. This item is the fourth in the vector. Save the changes by reassignment. - Display the modified
prices
vector.
Дякуємо за ваш відгук!
Видалення Елементів
Оскільки ви навчились додавати елементи до вектора, логічно також навчитися їх видаляти. Все йде до цього.
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the third element grades[-3]
Similarly, to eliminate the second and fourth elements from the initial grades
vector, you would proceed as follows:
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the second and fourth elements grades[-c(2,4)]
Swipe to show code editor
From the previous task, you have the prices
vector with the prices of 6 items. Your task is:
- Remove the
'Dining chair'
item from theprices
vector. This item is the fourth in the vector. Save the changes by reassignment. - Display the modified
prices
vector.
Дякуємо за ваш відгук!
Оскільки ви навчились додавати елементи до вектора, логічно також навчитися їх видаляти. Все йде до цього.
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the third element grades[-3]
Similarly, to eliminate the second and fourth elements from the initial grades
vector, you would proceed as follows:
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the second and fourth elements grades[-c(2,4)]
Swipe to show code editor
From the previous task, you have the prices
vector with the prices of 6 items. Your task is:
- Remove the
'Dining chair'
item from theprices
vector. This item is the fourth in the vector. Save the changes by reassignment. - Display the modified
prices
vector.