[R] Question concerning ggplot
Rainer M Krug
RKrug at sun.ac.za
Tue Oct 24 16:28:51 CEST 2006
hadley wickham wrote:
>> > rsqs <- as.data.frame(stamp(mtcars, cyl ~ ., function(df)
>> > summary(lm(mpg ~ wt, data=df))$r.squared))
>> > rsqs$wt <- 4
>> > rsqs$mpg <- 32
>> > ggtext(p, data=rsqs, aes=list(label=value))
>> >
>> > But that doesn't work for some reason I don't understand yet (but I'm
>> > working on it)
>
> Ooops - I just had the wrong version of reshape installed. It should
> work with the version available on cran.
Thanks again for the example - but I don't seem to be able to get it to
work in my context:
> p <- ggplot(tc, . ~ expert, aesthetic=list(y=x0050, x=generation))
> ggjitter(p)
> ggsmooth(method=lm)
> rsqs <- as.data.frame( stamp( tc, expert ~ ., function(df)
summary(lm(x0050 ~ generation, data=df))$r.squared))
> rsqs
expert value
1 BW 0.9056925
2 DM 0.9280401
3 DR 0.8044774
4 JH 0.7531401
5 Mean 0.9452478
6 TG 0.8816820
> ggtext(data=rsqs, aesthetics=list(label=value, x=1, y=8000))
Error in data.frame(data[, c(variables), drop = FALSE], result =
data$value) :
arguments imply differing number of rows: 6, 0
>
Can you give me a hint what I am doing wrong?
Rainer
>
> Hadley
--
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)
Department of Conservation Ecology and Entomology
University of Stellenbosch
Matieland 7602
South Africa
Tel: +27 - (0)72 808 2975 (w)
Fax: +27 - (0)21 808 3304
Cell: +27 - (0)83 9479 042
email: RKrug at sun.ac.za
Rainer at krugs.de
More information about the R-help
mailing list