[R] Converting list with different vector lengths into a dataframe (or export it as .csv)
Olivereta
imma.oliveras at ouce.ox.ac.uk
Wed Jan 8 16:55:32 CET 2014
Dear all,
I have this list
years <- list(c("2004", "2007"), c("2010", "2005"), c("2009", "2001"),
c("2006", "2000", "2004", "2009"), c("2006", "2000"), c("2006", "2000"),
c("2005", "2007"), c("2005", "2007"), c("2001", "2006"),
c("2005", "2001", "2008"), c("2005", "2001", "2008"), c("2005",
"2000"), c("2005", "2000"), c("2006", "2005", "2003"), c("2006",
"2005", "2003"), c("2007", "2004", "2007"), c("2004", "2007"
), c("2004", "2007"), c("2004", "2007"), c("2010", "2007"
), c("2008", "2005"), c("2008", "2005"), c("2008", "2005"
), c("2004", "2007"), c("2004", "2007"), c("2011", "2006"
), c("2009", "2005", "2003"), c("2009", "2005", "2003"),
c("2009", "2001"), c("2007", "2003", "2004"), c("2007", "2004"
), c("2007", "2004"), c("2008", "2010", "2001"), c("2010",
"2005"), c("2007", "2005"), c("2007", "2005"), c("2007",
"2005"), c("2010", "2005"), c("2010", "2005"), c("2010",
"2005"), c("2007", "2005"), c("2007", "2005"), c("2008",
"2007"), c("2003", "2005"), c("2003", "2005"), c("2005",
"2003"), c("2005", "2003"), c("2005", "2003"))
Each vector represents an location, and the years that this location has
burned. Therefore, I'd like to get a dataframe with each vector on a row,
and the years in columns, but I can't because vectors have different
lengths.
I have also tried to export it to a csv (and then open it with excel), but I
get the same error.
Thank a lot in advance for your valuable help.
--
View this message in context: http://r.789695.n4.nabble.com/Converting-list-with-different-vector-lengths-into-a-dataframe-or-export-it-as-csv-tp4683259.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list