reshape - Reshaping data in R using melt -


i have tried apply people have suggested reshape data, somehow failing data reshaped want it. appreciate if can help:

my data looks this:       ab      lp     pd1     pd2     py1     py2     py3     py4     py5 t 1 -50.000 -50.000 -50.000 -50.000 -50.000 -50.000 -50.000 -50.000 -50.000 1 2 -50.153 -53.316 -50.416 -50.416 -53.455 -53.467 -53.700 -53.403 -53.218 2 3 -50.288 -54.399 -50.726 -50.726 -53.603 -53.644 -54.457 -53.664 -53.776 3 4 -50.410 -53.630 -50.956 -50.956 -52.385 -52.649 -53.642 -52.575 -52.740 4 5 -50.519 -53.075 -51.127 -51.127 -52.072 -52.174 -53.132 -51.715 -52.563 5 6 -50.617 -52.616 -51.255 -51.255 -52.023 -51.947 -52.602 -51.857 -52.643 6 > 

and want change can plot ggplot need this:

ab -50.000 1 ab -50.153 2 ab -50.288 3 

etc, third columns last column original data, time (column t)

if use v=melt(values) this:

      variable   value 1       ab -50.000 2       ab -50.153 3       ab -50.288 4       ab -50.410 5       ab -50.519 6       ab -50.617 

which there, time column (t) added @ bottom. how time third column?

i believe format need data in plot multiple lines using ggplot2.

thanks help

jss

using reshape2, need do:

v <- melt(values, id.vars = "t") 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -