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@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.

Reply via email to