Re: [R] Help reading table rows into lists

2010-10-10 Thread Gabor Grothendieck
On Sun, Oct 10, 2010 at 3:29 PM, Alison Waller wrote: > Thanks Gabor and Jeffrey, > > and thanks for explaining the differences.  I think I'll go with Jeffery's > as I think I want entries for COGs with no pathway. > My second post does handle that case. -- Statistics & Software Consulting GKX

Re: [R] Help reading table rows into lists

2010-10-10 Thread Alison Waller
Thanks Gabor and Jeffrey, and thanks for explaining the differences. I think I'll go with Jeffery's as I think I want entries for COGs with no pathway. Alison On 10-Oct-10, at 8:59 PM, Jeffrey Spies wrote: sapply(dat, function(x){ tmp<-unlist(strsplit(x, '\t', fixed=T)) out <- list(t

Re: [R] Help reading table rows into lists

2010-10-10 Thread Gabor Grothendieck
On Sun, Oct 10, 2010 at 2:59 PM, Jeffrey Spies wrote: > To get just the list you wanted, Gabor's solution is more elegant, but > here's another using the apply family.  First, your data: > > dat <- > scan(file="/g/bork8/waller/test_COGtoPath.txt",what="character",sep="\n") > > I expect dat to be

Re: [R] Help reading table rows into lists

2010-10-10 Thread Jeffrey Spies
To get just the list you wanted, Gabor's solution is more elegant, but here's another using the apply family. First, your data: dat <- scan(file="/g/bork8/waller/test_COGtoPath.txt",what="character",sep="\n") I expect dat to be a vector of strings where each string is a line of values separated

Re: [R] Help reading table rows into lists

2010-10-10 Thread Gabor Grothendieck
On Sun, Oct 10, 2010 at 11:40 AM, Alison Waller wrote: > Hi all, > > I have a large table mapping thousands of COGs(groups of genes) to pathways. > # Ex > COG0001 patha   pathb   pathc > COG0002 pathd   pathe > COG0003 pathe   pathf   pathg   pathh > ## > > I would like to combine this information

[R] Help reading table rows into lists

2010-10-10 Thread Alison Waller
Hi all, I have a large table mapping thousands of COGs(groups of genes) to pathways. # Ex COG0001 patha pathb pathc COG0002 pathd pathe COG0003 pathe pathf pathg pathh ## I would like to combine this information into a big list such as below COG2PATHWAY<- list (COG0001 = c ("