Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Видалення Елементів | Вектори
Вступ до R: Частина 1
course content

Зміст курсу

Вступ до R: Частина 1

Вступ до R: Частина 1

1. Базовий Синтаксис та Команди
2. Вектори
3. Фактори

Видалення Елементів

Оскільки ви навчились додавати елементи до вектора, логічно також навчитися їх видаляти. Все йде до цього.

12345
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the third element grades[-3]
copy

Similarly, to eliminate the second and fourth elements from the initial grades vector, you would proceed as follows:

12345
# 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)]
copy

Завдання

From the previous task, you have the prices vector with the prices of 6 items. Your task is:

  1. Remove the 'Dining chair' item from the prices vector. This item is the fourth in the vector. Save the changes by reassignment.
  2. Display the modified prices vector.

Завдання

From the previous task, you have the prices vector with the prices of 6 items. Your task is:

  1. Remove the 'Dining chair' item from the prices vector. This item is the fourth in the vector. Save the changes by reassignment.
  2. Display the modified prices vector.
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 2. Розділ 9
toggle bottom row

Видалення Елементів

Оскільки ви навчились додавати елементи до вектора, логічно також навчитися їх видаляти. Все йде до цього.

12345
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the third element grades[-3]
copy

Similarly, to eliminate the second and fourth elements from the initial grades vector, you would proceed as follows:

12345
# 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)]
copy

Завдання

From the previous task, you have the prices vector with the prices of 6 items. Your task is:

  1. Remove the 'Dining chair' item from the prices vector. This item is the fourth in the vector. Save the changes by reassignment.
  2. Display the modified prices vector.

Завдання

From the previous task, you have the prices vector with the prices of 6 items. Your task is:

  1. Remove the 'Dining chair' item from the prices vector. This item is the fourth in the vector. Save the changes by reassignment.
  2. Display the modified prices vector.
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 2. Розділ 9
toggle bottom row

Видалення Елементів

Оскільки ви навчились додавати елементи до вектора, логічно також навчитися їх видаляти. Все йде до цього.

12345
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the third element grades[-3]
copy

Similarly, to eliminate the second and fourth elements from the initial grades vector, you would proceed as follows:

12345
# 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)]
copy

Завдання

From the previous task, you have the prices vector with the prices of 6 items. Your task is:

  1. Remove the 'Dining chair' item from the prices vector. This item is the fourth in the vector. Save the changes by reassignment.
  2. Display the modified prices vector.

Завдання

From the previous task, you have the prices vector with the prices of 6 items. Your task is:

  1. Remove the 'Dining chair' item from the prices vector. This item is the fourth in the vector. Save the changes by reassignment.
  2. Display the modified prices vector.
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Оскільки ви навчились додавати елементи до вектора, логічно також навчитися їх видаляти. Все йде до цього.

12345
# Vector of grades and names grades <- c(80, 75, 95, 100) names(grades) <- c('Math', 'Physics', 'English', 'Literature') # Remove the third element grades[-3]
copy

Similarly, to eliminate the second and fourth elements from the initial grades vector, you would proceed as follows:

12345
# 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)]
copy

Завдання

From the previous task, you have the prices vector with the prices of 6 items. Your task is:

  1. Remove the 'Dining chair' item from the prices vector. This item is the fourth in the vector. Save the changes by reassignment.
  2. Display the modified prices vector.
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 2. Розділ 9
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt