problem with ggplot

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

problem with ggplot

tonderai
This post has NOT been accepted by the mailing list yet.
i am trying to convert a dataset from wide to long format using package tidyr- (seems to have been done)

wen in try and plot the long dataset using ggplot i keep getting errors

here is the code

library(tidyr)
ht.long<-gather(ray.ht,age,height,X0:X84,factor_key = TRUE)
ht.long$ID<-factor(ht.long$ID)
ggplot(ht.long,aes(age,height,shape=ID))+geom_line()
ggplot(ht.long,aes(age,height))+ facet_wrap(~ID) + geom_line()


the error i keep getting is the folowing.

geom_path: Each group consists of only one observation. Do you
need to adjust the group aesthetic?


a part of the dataset is shown below

ID X0 X4 X8 X12 X36 X48 X84
1 50 59 65 67 87 95 115
2 54 58 69 71 90 96 115
3 52 64 68 70 91 100 120
4 50 56 67 68 88 95 115
5 54 59 68 72 93 100 120




Loading...