R: create categorical variables with case_when || 21

Publicado em: 22 Janeiro 2022
no canal de: 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


Nesta página do site você pode assistir ao vídeo on-line R: create categorical variables with case_when || 21 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Lab Time with R & Python 22 Janeiro 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 391 vezes e gostou 6 espectadores. Boa visualização!