I downloaded this data frm eurostat package in R, which is in long format:
structure(list(geo = c("DE", "EA20", "ES", "EU27_2020", "FR",
"IT", "DE", "EA20", "ES", "EU27_2020", "FR", "IT", "DE", "EA20",
"ES", "EU27_2020", "FR", "IT", "DE", "EA20", "ES", "EU27_2020",
"FR", "IT", "DE", "EA20", "ES", "EU27_2020", "FR", "IT"), time = structure(c(17532,
17532, 17532, 17532, 17532, 17532, 17532, 17532, 17532, 17532,
17532, 17532, 17532, 17532, 17532, 17532, 17532, 17532, 17532,
17532, 17532, 17532, 17532, 17532, 17532, 17532, 17532, 17532,
17532, 17532), class = "Date"), values = c(2.9, 9.1, 18.2, 8.2,
9.3, 12.2, 3.7, 8.3, 14.9, 7.5, 9.2, 10.2, 3.3, 8.7, 16.4, 7.8,
9.2, 11.1, 2.6, 8.2, 17.1, 7.3, 7.7, 10.7, 3.3, 7.3, 13.3, 6.6,
7.8, 8.6)), row.names = c(NA, -30L), class = c("tbl_df", "tbl",
"data.frame"))
I would like a table with these columns: time, geo, and values. To do so, I've tried:
taxaatur_EU_m_wide <- spread(taxaatur_EU_m, geo, values) %>% #Passar a format wide.
select("time", "UE", "ZE", "DE", "ES", "FR", "IT")
But it does not create any wide table.
Please try the
pivot_widerfunction as belowCreated on 2023-08-04 with reprex v2.0.2