R: create categorical variables with case_when || 21

Опубликовано: 22 Январь 2022
на канале: Lab Time with R & Python
391
6

In this video we use the case_when function from the dplyr package to generate categorical variables.

The dataset for the example:
(note that I replaced the assignment operator with = because YouTube does not allow to use angle brackets in the description)

build dataset ----
id = paste0("p", rep(1:4, 7))
id
year = rep(2010:2016, each = 4)
year
note the difference with
rep(2010:2016, 4)
status = c(0, 0, 1, 0, # 0 = not married
0, 1, 1, 0, # 1 = married
0, 1, 1, 0,
1, 1, 1, 0,
1, 1, 0, 0,
1, 1, 0, 0,
0, 1, 1, 0)
df = data.frame(year, id, status)
df


На этой странице сайта вы можете посмотреть видео онлайн R: create categorical variables with case_when || 21 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Lab Time with R & Python 22 Январь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 391 раз и оно понравилось 6 зрителям. Приятного просмотра!