Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Logical Indexing | Section
Essential R Programming for Absolute Beginners - 1768563985826

bookLogical Indexing

Logical indexing allows you to filter rows of a data frame based on conditions. Instead of remembering row numbers, you specify logical expressions, and only rows where the condition is TRUE are returned.

Example

123456789
name <- c("Alex", "Julia", "Finn") age <- c(24, 43, 32) gender <- c("M", "F", "M") test <- data.frame(name, age, gender) # People older than 30 test[test$age > 30, ] # Males only test[test$gender == 'M', ]
copy

The condition should be placed in the row index position inside square brackets ([condition, ]).

Завдання

Swipe to start coding

Using the mtcars dataset, extract the following data:

  1. The cars that pass a quarter-mile in less than 16 seconds (qsec column).
  2. Cars with 6 cylinders (cyl column).

Рішення

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 37
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

bookLogical Indexing

Свайпніть щоб показати меню

Logical indexing allows you to filter rows of a data frame based on conditions. Instead of remembering row numbers, you specify logical expressions, and only rows where the condition is TRUE are returned.

Example

123456789
name <- c("Alex", "Julia", "Finn") age <- c(24, 43, 32) gender <- c("M", "F", "M") test <- data.frame(name, age, gender) # People older than 30 test[test$age > 30, ] # Males only test[test$gender == 'M', ]
copy

The condition should be placed in the row index position inside square brackets ([condition, ]).

Завдання

Swipe to start coding

Using the mtcars dataset, extract the following data:

  1. The cars that pass a quarter-mile in less than 16 seconds (qsec column).
  2. Cars with 6 cylinders (cyl column).

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 37
single

single

some-alt