Skip to content

how to address last and all but last column in dataframe

2 messages · drflxms, David Winsemius

#
Hello Mr. Burns, Hello Mr. Dwinseminus

thank you very much for your incredible quick and efficient reply! I was
completely successful with the following command:

pairs<-data.frame(pred=factor(unlist(input[,-c(1,ncol(input))])),ref=factor(input[,ncol(input)]))

In case of the "input" example data.frame I sent with my question the
above code is equivalent to:
 
pairs<-data.frame(pred=factor(unlist(input[2:17])),ref=factor(input[,18]))

Great! That is exactly what I was looking for! This simple code will
save me hours!

Patrick, your book looks in fact very interesting and will be my perfect
reading material for the following nights :-) (probably not only the
first chapter ;-). Thanks for the hint - and the free book of course.

David, the "input" data.frame is the result of the reshape-command I
performed. I just copied it from the R-console into the e-mail. In fact
the first column "video" is not part of the data, but needed for
analysis with kappam.fleiss function of the irr-package. Sorry, you are
absolutely correct, I should have mentioned this in my question. I will
improve when I ask my next question :-).

Again I like to thank you for your help and wish you a pleasant Sunday.
Greetings from Munich,
Felix
Patrick Burns wrote:
#
On Sep 6, 2008, at 4:24 PM, drflxms wrote:

            
snip
I have not yet picked up facility with reshape. Is there a method  
using reshape to take its screen output and return a dataframe?