Skip to content

how to transform a data file

4 messages · pat j, Jorge I Velez, Jeff Newmiller +1 more

#
library(reshape2)
# sample data because you didn't provide any
dta <- as.data.frame( matrix( sample( 0:1, 100, replace=TRUE ), ncol=10 ) )
dta <- cbind( IDN=1:10, dta )
# The command you couldn't figure out
meltdta <- melt( dta, "IDN" )
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
pat j <pjsleuth at gmail.com> wrote:

            
#
Hi

option 3
library(reshape)
melt(d, id.vars="id")

Regards
Petr
(the
ranges
sequentially
v1
and
this
"c"
some
the
automatically
them
to do
http://www.R-project.org/posting-guide.html