ggplot with rms package

58 views
Skip to first unread message

Aric Gregson

unread,
Sep 25, 2009, 6:38:33 PM9/25/09
to ggplot2
Hello,

The newish rms package which is to replace Design says that it works
with ggplot2. However, I have not figured out a quick way to put in
the same sorts of plots with ggplot2.

plot(Predict(fit)) -> plots

ggplot(Predict(fit))
Error: No layers in plot

qplot(Predict(fit))
Error: attempt to apply non-function

ggplot(Predict(cumdsa400.lm), aes(cumdsa400, cumar400),
data=cumdsa400.lm) + geom_point()
Error in ggplot.data.frame(fortify(data), mapping, ...) :
Mapping should be created with aes or aes_string

Is it that it may work with ggplot, but you have to tell it the
parameters? That doesn't seem to be working either, i.e. telling it
what the x and y should be. I'm sure there is something obvious, but
it is confusing going back and forth between lattice and ggplot
graphics and I've been in lattice mostly of late.

Any suggestions are most appreciated.

Thanks, Aric

Aric Gregson

unread,
Sep 25, 2009, 7:27:52 PM9/25/09
to ggplot2
Aric Gregson wrote:

> The newish rms package which is to replace Design says that it works
> with ggplot2. However, I have not figured out a quick way to put in
> the same sorts of plots with ggplot2.
>
> plot(Predict(fit)) -> plots
>
> ggplot(Predict(fit))
> Error: No layers in plot
>
> qplot(Predict(fit))
> Error: attempt to apply non-function
>
> ggplot(Predict(cumdsa400.lm), aes(cumdsa400, cumar400),
> data=cumdsa400.lm) + geom_point()
> Error in ggplot.data.frame(fortify(data), mapping, ...) :
> Mapping should be created with aes or aes_string

Well, I realized that I don't really need to use rms and can just use
the lm in smooth from ggplot2 as it give exactly the same result. It
would be nice though to see what is meant by rms interacting with ggplot
now.

Aric

Mike Lawrence

unread,
Sep 30, 2009, 1:30:40 PM9/30/09
to Aric Gregson, ggplot2
Possibly what is meant is that you can pass "rms" as the method to stat_smooth.
--
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~
Reply all
Reply to author
Forward
0 new messages