Hi,
Try print(p) instead of plot(p)
HTH,
baptiste
2009/12/29 Bryan Hanson han...@depauw.edu:
I¹m trying to build a simple formula interface to work with a function using
ggplot2. The following scheme ³works² up until the plot(p) request, at which
point there are complaints about xlim¹s and a blank graphics window.
Looking at str(p) I do see the limits are NULL, plus layer 1 claims to have
an empty data frame (but df is reproduced correctly). I'm sure I'm missing
something really obvious; alas my ggplot2 book is at work and it's cold
outside!
simple - function(formula, data, ...){
mf - model.frame(formula = formula, data = data) }
res - rnorm(100)
f1 - rep(c(C, D, D, C), 25)
f2 - rep(c(A, B), 50)
mydata - data.frame(res, f1, f2)
df - simple(~ res + f1, mydata)
p - ggplot(df, aes(f1, res)) + geom_boxplot()
plot(p)
Thanks, Bryan
*
Bryan Hanson
Acting Chair
Professor of Chemistry Biochemistry
DePauw University, Greencastle IN USA
sessionInfo()
R version 2.10.1 (2009-12-14)
x86_64-apple-darwin9.8.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] datasets tools grid graphics grDevices utils stats
methods base
other attached packages:
[1] ggplot2_0.8.5 digest_0.4.2 reshape_0.8.3 proto_0.3-8
mvbutils_2.5.0 ChemoSpec_1.43
[7] R.utils_1.2.4 R.oo_1.6.5 R.methodsS3_1.0.3 rgl_0.87
lattice_0.17-26 mvoutlier_1.4
[13] plyr_0.1.9 RColorBrewer_1.0-2 chemometrics_0.5 som_0.3-4
robustbase_0.5-0-1 rpart_3.1-45
[19] pls_2.1-0 pcaPP_1.7 mvtnorm_0.9-8 nnet_7.3-1
mclust_3.4 MASS_7.3-4
[25] lars_0.9-7 e1071_1.5-22 class_7.3-1
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.