object not found when it exists ... ?

99 views
Skip to first unread message

Peter Flom

unread,
Sep 3, 2009, 2:37:41 PM9/3/09
to ggplot2group
Hello again

When I run

p1 <- qplot(as.factor(position), Pressure, data = monika)
p2 <- p1 + geom_boxplot()
p3 <- p2 + geom_jitter(position=position_jitter(width=.1), colour = eye)

I get an error
Erro in do.call("layer", list(mapping = mapping, data = data, stat = stat, :
object 'eye' not found

but if I type monika$eye ... it is there.

What am I doing wrong here?

thanks

Peter

Peter L. Flom, PhD
Statistical Consultant
www DOT peterflomconsulting DOT com
I write some at:http://www.associatedcontent.com/user/582880/peter_flom.html
I trade books at http://www.bookmooch.com/

Will

unread,
Sep 3, 2009, 3:28:35 PM9/3/09
to ggplot2
On Sep 3, 2:37 pm, Peter Flom <peterflomconsult...@mindspring.com>
wrote:

> When I run
>
> p1 <- qplot(as.factor(position), Pressure, data = monika)
> p2 <- p1 + geom_boxplot()
> p3 <- p2 + geom_jitter(position=position_jitter(width=.1), colour = eye)
>
> I get an error
> Erro in do.call("layer", list(mapping = mapping, data = data, stat = stat,  :
>   object 'eye' not found

> Peter L. Flom, PhD
> Statistical Consultant

Perhaps this is undefined behaviour? The R manual page for
`geom_jitter(mapping=NULL, data=NULL, stat="identity",
position="jitter", na.rm=FALSE, ...)`
mentions that '...' is ignored. I am running R v 2.9.2 and downloaded
ggplot2 this morning.

Ian Fellows

unread,
Sep 3, 2009, 3:34:24 PM9/3/09
to Will, ggplot2group
try:
geom_jitter(position=position_jitter(width=.1), aes(colour = eye))

Peter Flom

unread,
Sep 3, 2009, 3:49:19 PM9/3/09
to Ian Fellows, Will, ggplot2group
Thanks!  That worked.

Peter

Peter L. Flom, PhD
Statistical Consultant
www DOT peterflomconsulting DOT com
I write some at:http://www.associatedcontent.com/user/582880/peter_flom.html
Reply all
Reply to author
Forward
0 new messages