On 10/07/2009, at 2:55 AM, Gaurav Kumar wrote:
Hi,
I'm new to R and would like to know, how one can populate the list
with array data.
I'm reading a tab separated table in R. The data in the table looks
something like this.
#Table Data
Comp A B C
Extracellular 103 268 535759
Nucleus 45603 47783 442744
#R code
myData <- read.table("table.data",
header=T,
sep="\t",
comment.char = "#"
);
inp <- scan("table.data", what=list(comp=" ", A="", B="", C=""));
n <- c(0:length(inp$comp));
myList=list();
for(i in n-1)
{
obj <-c(as.numeric(myData$A[i]),as.numeric(myData$B
[i]),as.numeric(myData$C[i]));
}
Need help to know if there is any function in R to push obj to myList
(a) You apparently ``replied'' to an R-help digest, and included
megabytes
of totally irrelevant material in your post. It took me several
minutes to delete it.
STEP ONE: LEARN HOW TO USE EMAIL!!!
(b) Do the following:
myList <- list();
for(i in n-1)
{
myList[[i]] <-c(as.numeric(myData$A[i]),as.numeric(myData$B
[i]),as.numeric(myData$C[i]));
}
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
______________________________________________
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.