Permalink
Browse files

Roxygenise, fixing bugs

  • Loading branch information...
1 parent 83e8f8f commit c0af4ae659b996fcfddfa9d012eb2c80d695f161 @hadley committed Dec 24, 2011
View
@@ -4,8 +4,42 @@ Title: Layer related components from ggplot2
Version: 0.0.0
Author: Hadley Wickham <h.wickham@gmail.com>
Maintainer: Hadley Wickham <h.wickham@gmail.com>
-Description:
-Depends: R (>= 2.12)
-Imports: grid, scales, plyr
+Description:
+Depends:
+ R (>= 2.12)
+Imports:
+ grid,
+ scales,
+ plyr
License: MIT
LazyLoad: yes
+Collate:
+ 'adjust-fill.r'
+ 'adjust-stack.r'
+ 'adjust.r'
+ 'aesthetics-defaults.r'
+ 'aesthetics-group.r'
+ 'aesthetics.r'
+ 'geom-bar.r'
+ 'geom-line.r'
+ 'geom-path.r'
+ 'geom-point.r'
+ 'geom-polygon.r'
+ 'geom-rect.r'
+ 'geom-ribbon.r'
+ 'geom-rug.r'
+ 'geom-segment.r'
+ 'geom-step.r'
+ 'geom-text.r'
+ 'geom.r'
+ 'layer-defaults.r'
+ 'layer.r'
+ 'scaled-values.r'
+ 'stat-contour.r'
+ 'stat-density-point.r'
+ 'stat-density.r'
+ 'stat-density2d.r'
+ 'stat-identity.r'
+ 'stat-sum.r'
+ 'stat.r'
+ 'utils.r'
View
@@ -0,0 +1,80 @@
+export(aes_all)
+export(aes_default)
+export(aes_icon)
+export(aes_present)
+export(aes_required)
+export(build_defaults)
+export(geom_adjust)
+export(geom_bar)
+export(geom_data)
+export(geom_line)
+export(geom_munch)
+export(geom_name)
+export(geom_path)
+export(geom_plot)
+export(geom_point)
+export(geom_rect)
+export(geom_ribbon)
+export(geom_rug)
+export(geom_segment)
+export(geom_stat)
+export(geom_step)
+export(geom_text)
+export(geom_visualise)
+export(stat_contour)
+export(stat_density)
+export(stat_identity)
+export(stat_sum)
+import(plyr)
+import(scales)
+importFrom(MASS,kde2d)
+S3method(aes_default,bar)
+S3method(aes_default,path)
+S3method(aes_default,rect)
+S3method(aes_default,ribbon)
+S3method(aes_default,segment)
+S3method(aes_defaults,text)
+S3method(aes_present,density)
+S3method(aes_present,path)
+S3method(aes_required,bar)
+S3method(aes_required,contour)
+S3method(aes_required,density)
+S3method(aes_required,geom)
+S3method(aes_required,identity)
+S3method(aes_required,path)
+S3method(aes_required,rect)
+S3method(aes_required,ribbon)
+S3method(aes_required,segment)
+S3method(aes_required,text)
+S3method(geom_adjust,bar)
+S3method(geom_adjust,default)
+S3method(geom_data,default)
+S3method(geom_data,line)
+S3method(geom_data,path)
+S3method(geom_data,step)
+S3method(geom_grob,bar)
+S3method(geom_grob,path)
+S3method(geom_grob,rect)
+S3method(geom_grob,ribbon)
+S3method(geom_grob,rug)
+S3method(geom_grob,segment)
+S3method(geom_grob,text)
+S3method(geom_munch,bar)
+S3method(geom_munch,default)
+S3method(geom_munch,rect)
+S3method(geom_munch,segment)
+S3method(geom_stat,bar)
+S3method(geom_stat,default)
+S3method(geom_visaulise,text)
+S3method(geom_visualise,bar)
+S3method(geom_visualise,default)
+S3method(geom_visualise,line)
+S3method(geom_visualise,path)
+S3method(geom_visualise,rect)
+S3method(geom_visualise,ribbon)
+S3method(geom_visualise,segment)
+S3method(geom_visualise,step)
+S3method(stat_transform,contour)
+S3method(stat_transform,density)
+S3method(stat_transform,identity)
+S3method(stat_transform,sum)
View
@@ -7,6 +7,7 @@
#' @export
#' @S3method geom_data step
#' @S3method geom_visualise step
+#' @examples
#' df <- data.frame(x = 1:10, y = 1:10)
#' geom_plot(geom_step(), df)
#' geom_plot(geom_step(direction = "vh"), df)
View
@@ -8,9 +8,9 @@
#' @export
#' @S3method aes_required text
#' @S3method aes_defaults text
-#' @S3meothd geom_grob text
-#' @S3meothd geom_visaulise text
-#' @example
+#' @S3method geom_grob text
+#' @S3method geom_visaulise text
+#' @examples
#' df <- data.frame(x = 1:5, y = 1:5, label = letters[1:5])
#' geom_plot(geom_text(), df)
#' geom_plot(geom_text(list(angle = 45)), df)
View
@@ -1,9 +1,8 @@
#' The layers package.
#'
-#' @imports scales plyr
-#' @doctype package
+#' @import scales plyr
+#' @docType package
#' @name layers
-#' @aliases layers package-layers
NULL
geom_from_layer <- function(name, call = NULL) {
@@ -70,23 +69,13 @@ layer <- function() {
}
-#' Generates parameter description for a geom-layer.
+# Generates parameter description for a geom-layer.
rd_geom_params <- function(geom) {
# Parse documentation and extract parameters
# Add extra description for mapping, data, and ... (including a list of
# all valid aesthetics)
}
-#' @param inherit.aes
-#' @param legend single logical value. If \code{TRUE} forces display of this
-#' layer on the legend, if \code{FALSE} never displays, if \code{NA}
-#' only if it shows data.
-#' @param train.limits if \code{FALSE} data on this layer will not affect
-#' scale limits
-#' @param subset a quoted expression giving a subset expression to use to
-#' subset the dta
-
-
build_layer <- function(mapping, data, geom, stat, adjust, params, geom.params, stat.params) {
args <- parse_dots(list(...), stat = stat, position = position)
View
@@ -38,30 +38,30 @@
#' # Also works with categorical variables
#' ggplot(movies, aes(x=mpaa)) + stat_bin()
#' qplot(mpaa, data=movies, stat="bin")
-StatBin <- proto(Stat, {
- objname <- "bin"
-
- informed <- FALSE
-
- calculate_groups <- function(., data, ...) {
- .$informed <- FALSE
- .super$calculate_groups(., data, ...)
- }
-
- calculate <- function(., data, scales, bins = 30, binwidth=NULL, origin=NULL, breaks=NULL, width=0.9, drop = FALSE, right = TRUE, ...) {
- range <- scales$x$output_set()
-
- if (!is.null(breaks)) {
- breaks <- interval_breaks(bins, binwidth, origin)
- }
- open <- if (right) "right" else "left"
-
- bin_interval(data$x, data$weight, breaks = breaks, open = open)
- }
-
- icon <- function(.) GeomHistogram$icon()
- default_aes <- function(.) aes(y = ..count..)
- required_aes <- c("x")
- default_geom <- function(.) GeomBar
-
-})
+# StatBin <- proto(Stat, {
+# objname <- "bin"
+#
+# informed <- FALSE
+#
+# calculate_groups <- function(., data, ...) {
+# .$informed <- FALSE
+# .super$calculate_groups(., data, ...)
+# }
+#
+# calculate <- function(., data, scales, bins = 30, binwidth=NULL, origin=NULL, breaks=NULL, width=0.9, drop = FALSE, right = TRUE, ...) {
+# range <- scales$x$output_set()
+#
+# if (!is.null(breaks)) {
+# breaks <- interval_breaks(bins, binwidth, origin)
+# }
+# open <- if (right) "right" else "left"
+#
+# bin_interval(data$x, data$weight, breaks = breaks, open = open)
+# }
+#
+# icon <- function(.) GeomHistogram$icon()
+# default_aes <- function(.) aes(y = ..count..)
+# required_aes <- c("x")
+# default_geom <- function(.) GeomBar
+#
+# })
View
@@ -27,24 +27,24 @@
#' xlim = c(4, 10), ylim = c(4, 10))
#' qplot(x, y, data = diamonds, geom="bin2d", binwidth = c(0.1, 0.1),
#' xlim = c(4, 10), ylim = c(4, 10))
-StatBin2d <- proto(Stat, {
- objname <- "bin2d"
-
- default_aes <- function(.) aes(fill = ..count..)
- required_aes <- c("x", "y")
- default_geom <- function(.) GeomRect
-
- calculate <- function(., data, scales, binwidth = NULL, bins = c(30, 30), breaks = NULL, origin = NULL, drop = TRUE, ...) {
-
- bins <- bin_rect(data$x, data$y, data$weight,
- xbreaks = interval_breaks(bins[1], binwidth[1],
- range = scales$x$output_set()),
- ybreaks = interval_breaks(bins[2], binwidth[2],
- range = scales$y$output_set()),
- )
-
- if (drop) bins <- bins[bins$count > 0, ]
- bins$density <- bin$count / sum(bin$count, na.rm = TRUE)
- bins
- }
-})
+# StatBin2d <- proto(Stat, {
+# objname <- "bin2d"
+#
+# default_aes <- function(.) aes(fill = ..count..)
+# required_aes <- c("x", "y")
+# default_geom <- function(.) GeomRect
+#
+# calculate <- function(., data, scales, binwidth = NULL, bins = c(30, 30), breaks = NULL, origin = NULL, drop = TRUE, ...) {
+#
+# bins <- bin_rect(data$x, data$y, data$weight,
+# xbreaks = interval_breaks(bins[1], binwidth[1],
+# range = scales$x$output_set()),
+# ybreaks = interval_breaks(bins[2], binwidth[2],
+# range = scales$y$output_set()),
+# )
+#
+# if (drop) bins <- bins[bins$count > 0, ]
+# bins$density <- bin$count / sum(bin$count, na.rm = TRUE)
+# bins
+# }
+# })
View
@@ -12,12 +12,14 @@
#' @S3method stat_transform density
#' @S3method aes_required density
#' @S3method aes_present density
-#' @result \item{density}{density estimate}
-#' @result \item{count}{density * number of points, an approximate count, and
-#' useful for stacked density plots}
-#' @result \item{scaled}{density estimate, scaled to maximum of 1}
-#' @seealso \code{\link{stat_bin}} for the histogram
-#' @seealso \code{\link{density}} for details of the algorithm used
+#' @return \itemize{
+#' \item{density}{density estimate}
+#' \item{count}{density * number of points, an approximate count, and
+#' useful for stacked density plots}
+#' \item{scaled}{density estimate, scaled to maximum of 1}
+#' }
+#' @seealso \code{\link{stat_bin}} for the histogram,
+#' \code{\link{density}} for details of the algorithm used
stat_density <- function(adjust = 1, kernel = "gaussian", bw = "nrd0", n = 512) {
stat_from_call("density")
}
View
@@ -0,0 +1,15 @@
+\name{add_group}
+\alias{add_group}
+\title{Ensure that the data frame contains a grouping variable.}
+\usage{
+ add_group(data)
+}
+\value{
+ a data.frame with group variable
+}
+\description{
+ If the \code{group} variable is not present, then a new
+ group variable is generated from the interaction of all
+ discrete (factor or character) vectors excluding label.
+}
+
View
@@ -0,0 +1,12 @@
+\name{adjust_fill}
+\alias{adjust_fill}
+\title{Stack overlapping objects on top of one another, and standardise
+to have equal height.}
+\usage{
+ adjust_fill(width = NULL)
+}
+\description{
+ Stack overlapping objects on top of one another, and
+ standardise to have equal height.
+}
+
View
@@ -0,0 +1,10 @@
+\name{adjust_stack}
+\alias{adjust_stack}
+\title{Stack overlapping objects on top of one another}
+\usage{
+ adjust_stack(width)
+}
+\description{
+ Stack overlapping objects on top of one another
+}
+
View
@@ -0,0 +1,10 @@
+\name{aes_all}
+\alias{aes_all}
+\title{All aesthetics}
+\usage{
+ aes_all(geom)
+}
+\description{
+ All aesthetics
+}
+
View
@@ -0,0 +1,16 @@
+\name{aes_default}
+\alias{aes_default}
+\title{Default aesthetics.}
+\usage{
+ aes_default(geom)
+}
+\value{
+ named list of default values
+}
+\description{
+ These values are used to fill in missing aesthetics to
+ provide default values. See \code{\link{build_defaults}}
+ for a way to build defaults from a common list of
+ options.
+}
+
View
@@ -0,0 +1,13 @@
+\name{aes_icon}
+\alias{aes_icon}
+\title{Default aesthetics for drawing representation icons.}
+\usage{
+ aes_icon(geom)
+}
+\value{
+ list of aesthetics
+}
+\description{
+ Default aesthetics for drawing representation icons.
+}
+
Oops, something went wrong.

0 comments on commit c0af4ae

Please sign in to comment.