Hi again! Just in case someone ends up googling this for the same thing I
did, here is a modification to get around a little problem:
dat1<-data.frame(keys=paste("key",5:1,sep=""),value=1:5)
splitlist <- split(dat1,dat1$keys)
list3<-sapply(splitlist,`[`,2)
names(list3)<-names(splitlist)
list3$
Brilliant! Thank you both, this works!
Combined with the other suggestion of setting stringsAsFactors to FALSE when
reading in the data frame, I now have the behaviour I wanted.
I had been beginning to get the sense that one of the apply functions was
the solution. I will now do some reading on
352
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of arun
> Sent: Wednesday, October 10, 2012 12:49 PM
> To: VA Smith
> Cc: R help
> Subject: Re: [R] reading in a (very simple) list from a file
>
>
Smith
To: r-help@r-project.org
Cc:
Sent: Wednesday, October 10, 2012 1:29 PM
Subject: [R] reading in a (very simple) list from a file
Apologies - I feel this is a very simple thing to do yet I am failing
massively. I keep finding information about how to do much more complicated
things (usually o
tober 10, 2012 1:29 PM
Subject: [R] reading in a (very simple) list from a file
Apologies - I feel this is a very simple thing to do yet I am failing
massively. I keep finding information about how to do much more complicated
things (usually on this mailing list!), which then fail when I try to apply
Apologies - I feel this is a very simple thing to do yet I am failing
massively. I keep finding information about how to do much more complicated
things (usually on this mailing list!), which then fail when I try to apply
it to my simple task.
Anyway, all I want to do is read in a series of key-va
6 matches
Mail list logo