Displaying 1 result from an estimated 1 matches for "median_price".
Did you mean:
mean_price
2013 Feb 18
1
ggplot2 and facet_wrap help
...breaks=11)
df=df[sample(nrow(df)),]
df$clarity = 1:nrow(df)
df$clarity = cut(df$clarity, breaks=6)
mydf = aggregate(df$price, by=list(df$size1, df$size2, df$clarity),median)
names(mydf)[1] = 'size1'
names(mydf)[2] = 'size2'
names(mydf)[3] = 'clarity'
names(mydf)[4] = 'median_price'
# So my data is already in a "long" format I think, but when I do this:
ggplot(data=mydf, aes(x=mydf$size2, y=mydf$median_price,
group=as.factor(mydf$clarity), colour=as.factor(mydf$clarity))) +
geom_line() + facet_wrap(~ factor(mydf$size1))
I get this error:
"Error in layou...