Hi R -users, i've a table as describe below. I'm reading the numeric value presented in this table to populate a list.
#table #============ #X A B C #x1 2 3 4 #x2 5 7 10 #x4 2 3 5 #============ rawData <- read.table("raw_data.txt",header=T, sep="\t") myList=list() counter=0 for (i in c(1:length(rawData$X))) { print (i) myList[counter <- counter +1]=as.numeric(rawData$A[i]); myList[counter <- counter +1]=as.numeric(rawData$B[i]); myList[counter <- counter +1]=as.numeric(rawData$C[i]); } print(myList) comp <- factor(rep(c("A","B","C"),c(3,3,3))) cell <- factor(rep(c("x1","x2","x3"),3)) t <- data.frame(comp,cell) print(t) i'm looking for the output show below # comp cell value #1 A x1 2 #2 A x2 5 #3 A x3 2 #4 B x1 3 #5 B x2 7 #6 B x3 3 #7 C x1 4 #8 C x2 10 #9 C x3 5 Help needed as how i should provide list as a third argument to data.frame(). Thanks in advance. Gaurav Kumar www.gauravkumar.org PhD Student, Chemistry and Biomolecular Sciences, Macquarie , Sydney, Australia. MS (Computational Biology), NCBS-TIFR, Bangalore, India. [[alternative HTML version deleted]]
______________________________________________ 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.