Hi friends, I have a problem manipulating data. Could you help me please?
I have this information:
ca_covid19 <- read.csv(file='https://raw.githubusercontent.com/pf0953-programaciongeoespacialr-2020/datos/master/covid19/casos/ca/2020_09_15_CSV_GENERAL.csv')
ca_covid19
And I have gathered it using gather from dply:
Covid <- gather(ca_covid19, factores, frecuencia, -1)
Covid
But I need to replicate each factor by frequency to get tow columns with character values (pais, factores), I used:
Covid %>%
group_by(pais) %>%
summarise(factor = rep(factores, frecuencia))
But doesn't work, return this: Error: Column factor
must be length 1 (a summary value), not 3002.
Summarize work with length 1?
How can I solved to get:
Pais ________Factor
Belize::::::::::::::fallecimiento
Belize::::::::::::: fallecimiento
Belize::::::::::::::activo
thanks