Thanks A.K. and Jeff, both answers helped me.
(and of course gave me more homework!)
On 31/12/13 16:04, Jeff Newmiller wrote:
A.K. answered your question 1, but since you did say as question 2 that you
wanted it done right...
library(reshape2)
ex3 <- function() {
d <- data.frame(x=1:5,a=1:5
A.K. answered your question 1, but since you did say as question 2 that you
wanted it done right...
library(reshape2)
ex3 <- function() {
d <- data.frame(x=1:5,a=1:5,b=2:6,c=3:7)
dl <- melt( d, id.vars="x" )
ggplot(dl,aes(x=x,y=value,color=variable))+
geom_line()
}
Hi,
Try:
ex2 <- function() {
d <- data.frame(x=1:5,a=1:5,b=2:6,c=3:7)
g <- ggplot(d, aes(x))
for (n in c("a","b","c")) {
g <- g + geom_line(aes_string(y=n,colour=n))
}
return(g)
}
A.K.
On Monday, December 30, 2013 7:49 PM, Geoffrey
wrote:
I am trying add geom_line's using a l
3 matches
Mail list logo