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
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
3 matches
Mail list logo