[R] creating a dataframe using a list of the variable names

From: Stephane Bourgeois <sb20_at_sanger.ac.uk>
Date: Sun, 29 Jun 2008 00:50:30 +0000 (UT)
('binary' encoding is not supported, stored as-is) ('binary' encoding is not supported, stored as-is)
Hello,

I'm fairly new to R, and despite spending quite some time exploring, testing, and looking for answers, I still have a couple of questions remaining...

The first one is about creating a dataframe using a list of the variable names .

I get this output file from a database:

BOB <- c('A/A', 'C/C', '15/27')
MARY <- c('A/A', NA, '13/12')
JOHN <- c('A/A', 'C/A', '154/35')
CLIFF <- c('A/C', 'C/C', '15/12')
PAM <- c('A/C', 'C/A', '13/12')

sampleList <- c("BOB", "MARY", "JOHN", "CLIFF", "PAM") polyList <- c("rs123", "rs124", "rs555")

to create a dataframe with the data I use:

data.raw <- data.frame(BOB, MARY, JOHN, CLIFF, PAM, row.names=polyList)

which works fine, but when there are several hundreds samples... well, you guess my problem.

I'd like to create the dataframe using the list of the variables, contained in sampleList - i.e. something like data.frame(function(sampleList), row.names=polyList)

Is that possible, and if yes, how?

Thanks in advance,

Stephane



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. Received on Sun 29 Jun 2008 - 00:56:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 29 Jun 2008 - 05:30:49 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive