Posts by Nayla • 63 points
2 posts
-
4
votes1
answer72
viewsQ: How to transpose from "wide" to "long" (wide to long) with several variables?
I have a dataframe with multiple variables, as in the example below: df <- read.table(header=TRUE, text=" ID COR TIPO SITUACAO_2016 SITUACAO_2017 SITUACAO_2018 SITUACAO_2019 SITUACAO_2020…
-
2
votes0
answers32
viewsQ: Recoding factors from the relative frequency of levels and the mean value of a continuous variable
I have a dataframe with several variables of the type factors that I need to recode. An example of my data is the following: structure(list(ID = 1:100, faixa_etaria = structure(c(2L, 7L, 3L, 4L, 5L,…