- 1. converting a data frame to a list (score: 1)
- Author: "Walter R. Paczkowski" <dataanalytics@earthlink.net>
- Date: Sat, 20 May 2006 12:51:45 -0400
- Suppose I have a data frame with n rows and six columns. I want to create a list that has, say, 3 components each with all n rows but with the first having the first two columns of the original data
- /archives/html/s-news/2006-05/msg00071.html (7,610 bytes)
- 2. Re: converting a data frame to a list (score: 1)
- Author: Dimitrios Rizopoulos <Dimitris.Rizopoulos@med.kuleuven.be>
- Date: Sat, 20 May 2006 19:20:45 +0200
- you could try something along these lines: dat <- data.frame(x = rnorm(100), y = sample(letters, 100, TRUE), z = sample(LETTERS, 100, TRUE), w = runif(100), k = rexp(100, 2), m = rep(c("yes", "No"),
- /archives/html/s-news/2006-05/msg00072.html (9,575 bytes)
- 3. Re: converting a data frame to a list (score: 1)
- Author: "Liaw, Andy" <andy_liaw@merck.com>
- Date: Mon, 22 May 2006 23:26:03 -0400
- Doing lapply() "backward" should work; e.g., idx <- split(1:6, rep(1:3, each=2)) mylist <- lapply(idx, function(i) mydata[,i]) Cheers, Andy _____ Hi, Suppose I have a data frame with n rows and six c
- /archives/html/s-news/2006-05/msg00081.html (8,209 bytes)
This search system is powered by
Namazu