Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix namespace/dependency issues

  • Loading branch information...
commit a1e766bdaddf3b1acb1a5a35da1ac49e53846fae 1 parent 463553a
@hadley authored
View
7 DESCRIPTION
@@ -14,7 +14,9 @@ Description: An implementation of the grammar of graphics
data to aesthetic attributes. See the ggplot2 website
for more information, documentation and examples.
Depends:
- R (>= 2.14)
+ R (>= 2.14),
+ stats,
+ methods
Imports:
plyr (>= 1.0),
digest,
@@ -22,7 +24,8 @@ Imports:
reshape2,
scales,
memoise,
- proto
+ proto,
+ MASS
Suggests:
quantreg,
Hmisc,
View
1  NAMESPACE
@@ -207,6 +207,7 @@ import(plyr)
import(proto)
import(reshape2)
import(scales)
+importFrom(MASS,kde2d)
S3method("[",uneval)
S3method("+",ggplot)
S3method(as.character,uneval)
View
10 R/scale-brewer.r
@@ -40,8 +40,8 @@ scale_fill_brewer <- function(..., type = "seq", palette = 1) {
discrete_scale("fill", "brewer", brewer_pal(type, palette), ...)
}
-icon.brewer <- function() {
- rectGrob(c(0.1, 0.3, 0.5, 0.7, 0.9), width=0.21,
- gp=gpar(fill=RColorBrewer::brewer.pal(5, "PuOr"), col=NA)
- )
-}
+# icon.brewer <- function() {
+# rectGrob(c(0.1, 0.3, 0.5, 0.7, 0.9), width=0.21,
+# gp=gpar(fill=RColorBrewer::brewer.pal(5, "PuOr"), col=NA)
+# )
+# }
View
6 R/stat-density-2d.r
@@ -5,6 +5,7 @@
#' @param n number of grid points in each direction
#' @param ... other arguments passed on to \code{\link{kde2d}}
#' @return A data frame in the same format as \code{\link{stat_contour}}
+#' @importFrom MASS kde2d
#' @export
#' @examples
#' m <- ggplot(movies, aes(x=rating, y=length)) +
@@ -12,7 +13,8 @@
#' scale_y_continuous(limits=c(1, 500))
#' m + geom_density2d()
#'
-#' dens <- MASS::kde2d(movies$rating, movies$length, n=100)
+#' library(MASS)
+#' dens <- kde2d(movies$rating, movies$length, n=100)
#' densdf <- data.frame(expand.grid(rating = dens$x, length = dens$y),
#' z = as.vector(dens$z))
#' m + geom_contour(aes(z=z), data=densdf)
@@ -63,7 +65,7 @@ StatDensity2d <- proto(Stat, {
df <- data.frame(data[, c("x", "y")])
df <- remove_missing(df, na.rm, name = "stat_density2d", finite = TRUE)
- dens <- safe.call(MASS::kde2d, c(df, n = n, ...))
+ dens <- safe.call(kde2d, c(df, n = n, ...))
df <- with(dens, data.frame(expand.grid(x = x, y = y), z = as.vector(z)))
df$group <- data$group[1]
View
3  R/stat-qq.r
@@ -24,7 +24,8 @@
#' ggplot(df, aes(sample = y)) + geom_point(stat = "qq")
#'
#' # Use fitdistr from MASS to estimate distribution params
-#' params <- as.list(MASS::fitdistr(y, "t")$estimate)
+#' library(MASS)
+#' params <- as.list(fitdistr(y, "t")$estimate)
#' ggplot(df, aes(sample = y)) + stat_qq(dist = qt, dparam = params)
#'
#' # Using to explore the distribution of a variable
View
3  R/stat-smooth.r
@@ -43,9 +43,10 @@
#' c + stat_smooth(method = "lm") + geom_point()
#'
#' library(splines)
+#' library(MASS)
#' c + stat_smooth(method = "lm", formula = y ~ ns(x,3)) +
#' geom_point()
-#' c + stat_smooth(method = MASS::rlm, formula= y ~ ns(x,3)) + geom_point()
+#' c + stat_smooth(method = rlm, formula= y ~ ns(x,3)) + geom_point()
#'
#' # The default confidence band uses a transparent colour.
#' # This currently only works on a limited number of graphics devices
View
4 R/zzz.r
@@ -5,9 +5,9 @@ tips <- c(
"\", package = \"ggplot2\")", sep = ""),
"Use suppressPackageStartupMessages to eliminate package startup messages."
)
-
+
.onLoad <- function(...) {
- if (runif(1) > 0.1) return()
+ if (stats::runif(1) > 0.1) return()
tip <- sample(tips, 1)
packageStartupMessage(tip)
View
3  man/stat_density2d.Rd
@@ -28,7 +28,8 @@ m <- ggplot(movies, aes(x=rating, y=length)) +
scale_y_continuous(limits=c(1, 500))
m + geom_density2d()
-dens <- MASS::kde2d(movies$rating, movies$length, n=100)
+library(MASS)
+dens <- kde2d(movies$rating, movies$length, n=100)
densdf <- data.frame(expand.grid(rating = dens$x, length = dens$y),
z = as.vector(dens$z))
m + geom_contour(aes(z=z), data=densdf)
View
3  man/stat_qq.Rd
@@ -41,7 +41,8 @@ ggplot(df, aes(sample = y)) + stat_qq()
ggplot(df, aes(sample = y)) + geom_point(stat = "qq")
# Use fitdistr from MASS to estimate distribution params
-params <- as.list(MASS::fitdistr(y, "t")$estimate)
+library(MASS)
+params <- as.list(fitdistr(y, "t")$estimate)
ggplot(df, aes(sample = y)) + stat_qq(dist = qt, dparam = params)
# Using to explore the distribution of a variable
View
3  man/stat_smooth.Rd
@@ -61,9 +61,10 @@ c + stat_smooth(level = 0.99) + geom_point()
c + stat_smooth(method = "lm") + geom_point()
library(splines)
+library(MASS)
c + stat_smooth(method = "lm", formula = y ~ ns(x,3)) +
geom_point()
-c + stat_smooth(method = MASS::rlm, formula= y ~ ns(x,3)) + geom_point()
+c + stat_smooth(method = rlm, formula= y ~ ns(x,3)) + geom_point()
# The default confidence band uses a transparent colour.
# This currently only works on a limited number of graphics devices
Please sign in to comment.
Something went wrong with that request. Please try again.