Hi, I would like to read several datasets and would like to create a set (list? sequence?) of many empty dataframes. How could this be done? How could I declare a set (list? sequence?) of many empty matrices? Thanks, Miao [[alternative HTML version deleted]]
Rui Barradas
2013-May-03 15:51 UTC
[R] Declare a set (list?) of many dataframes or matrices
Hello, I can't say I understand the question, but if you want a list of empty dfs and a list of empty matrices, the following will do. replicate(10, data.frame()) replicate(10, matrix(NA, nrow = 0, ncol = 0)) Hope this helps, Rui Barradas Em 03-05-2013 16:20, jpm miao escreveu:> Hi, > > I would like to read several datasets and would like to create a set > (list? sequence?) of many empty dataframes. How could this be done? How > could I declare a set (list? sequence?) of many empty matrices? > > Thanks, > > Miao > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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. >
Hi, I am not sure about what you meant. lapply(1:5,function(i) data.frame()) [[1]] data frame with 0 columns and 0 rows [[2]] data frame with 0 columns and 0 rows [[3]] data frame with 0 columns and 0 rows [[4]] data frame with 0 columns and 0 rows [[5]] data frame with 0 columns and 0 rows A.K. ----- Original Message ----- From: jpm miao <miaojpm at gmail.com> To: r-help <r-help at r-project.org> Cc: Sent: Friday, May 3, 2013 11:20 AM Subject: [R] Declare a set (list?) of many dataframes or matrices Hi, ?? I would like to read several datasets and would like to create a set (list? sequence?) of many empty dataframes. How could this be done? How could I declare a? set (list? sequence?) of many empty matrices? ?? Thanks, Miao ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list 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.
Possibly Parallel Threads
- How can I declare an empty zoo object?
- How can I tabulate time series data (in RStudio or any other R editor)?
- Why can't R understand if(num!=NA)?
- Transformation of a variable in a dataframe
- Input and output of time series data - any function or packages that helps?