Dear Javad, data <- "Date Cases Country 2020-12-14 746 Country1 2020-12-15 324 Country1 2020-12-15 1 Country3 2020-12-13 298 Country2" data <- read.table(text=data, header=T) x <- reshape( data=data, timevar = "Country", idvar = "Date", direction = "wide") data x
yields Date Cases Country 1 2020-12-14 746 Country1 2 2020-12-15 324 Country1 3 2020-12-15 1 Country3 4 2020-12-13 298 Country2 Date Cases.Country1 1 2020-12-14 746 2 2020-12-15 324 4 2020-12-13 NA Cases.Country3 Cases.Country2 1 NA NA 2 1 NA 4 NA 298 Best, Rasmus
signature.asc
Description: PGP signature
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.