Permalink
Browse files

Removed xxx.r (build_accessor file) and @name tags, added functions t…

…o geoms/positions/stats
  • Loading branch information...
1 parent b5edd86 commit ede677cb172b90af7c8f1cb3d973429a0c03171e @JakeRuss JakeRuss committed Jun 28, 2011
Showing with 417 additions and 136 deletions.
  1. +0 −1 DESCRIPTION
  2. +5 −2 R/geom-abline.r
  3. +5 −2 R/geom-bar-.r
  4. +4 −1 R/geom-bar-histogram.r
  5. +5 −2 R/geom-bin2d.r
  6. +4 −1 R/geom-blank.r
  7. +7 −1 R/geom-boxplot.r
  8. +7 −2 R/geom-crossbar.r
  9. +5 −2 R/geom-error.r
  10. +5 −2 R/geom-errorh.r
  11. +10 −7 R/geom-freqpoly.r
  12. +5 −2 R/geom-hex.r
  13. +4 −1 R/geom-hline.r
  14. +4 −1 R/geom-linerange.r
  15. +6 −1 R/geom-path-.r
  16. +6 −1 R/geom-path-contour.r
  17. +7 −2 R/geom-path-density2d.r
  18. +4 −1 R/geom-path-line.r
  19. +6 −1 R/geom-path-step.r
  20. +6 −1 R/geom-point-jitter.r
  21. +4 −1 R/geom-pointrange.r
  22. +4 −1 R/geom-polygon.r
  23. +6 −1 R/geom-quantile.r
  24. +4 −1 R/geom-rect.r
  25. +13 −3 R/geom-ribbon-.r
  26. +6 −1 R/geom-ribbon-density.r
  27. +4 −1 R/geom-rug.r
  28. +4 −1 R/geom-segment.r
  29. +4 −1 R/geom-smooth.r
  30. +6 −1 R/geom-text.r
  31. +4 −1 R/geom-tile.r
  32. +4 −1 R/geom-vline.r
  33. +4 −1 R/position-dodge.r
  34. +4 −1 R/position-fill.r
  35. +4 −1 R/position-identity.r
  36. +4 −1 R/position-jitter.r
  37. +4 −1 R/position-stack.r
  38. +6 −1 R/stat-bin.r
  39. +6 −1 R/stat-bin2d.r
  40. +6 −1 R/stat-binhex.r
  41. +6 −1 R/stat-boxplot.r
  42. +6 −1 R/stat-contour.r
  43. +6 −1 R/stat-density-2d.r
  44. +6 −1 R/stat-density.r
  45. +6 −1 R/stat-function.r
  46. +5 −1 R/stat-identity.r
  47. +6 −2 R/stat-qq.r
  48. +8 −1 R/stat-quantile.r
  49. +8 −1 R/stat-smooth.r
  50. +4 −1 R/stat-spoke.r
  51. +4 −1 R/stat-sum.r
  52. +4 −1 R/stat-summary.r
  53. +4 −1 R/stat-unique.r
  54. +16 −3 R/stat-vline.r
  55. +0 −57 R/xxx.r
  56. +2 −0 man/geom_abline.Rd
  57. +2 −0 man/geom_area.Rd
  58. +1 −0 man/geom_bar.Rd
  59. +2 −0 man/geom_bin2d.Rd
  60. +2 −0 man/geom_blank.Rd
  61. +3 −0 man/geom_boxplot.Rd
  62. +3 −0 man/geom_contour.Rd
  63. +2 −0 man/geom_crossbar.Rd
  64. +2 −0 man/geom_density.Rd
  65. +3 −0 man/geom_density2d.Rd
  66. +2 −0 man/geom_errorbar.Rd
  67. +2 −0 man/geom_errorbarh.Rd
  68. +8 −6 man/geom_freqpoly.Rd
  69. +2 −0 man/geom_hex.Rd
  70. +2 −0 man/geom_histogram.Rd
  71. +2 −0 man/geom_hline.Rd
  72. +2 −0 man/geom_jitter.Rd
  73. +2 −0 man/geom_line.Rd
  74. +2 −0 man/geom_linerange.Rd
  75. +3 −0 man/geom_path.Rd
  76. +2 −0 man/geom_pointrange.Rd
  77. +2 −0 man/geom_polygon.Rd
  78. +3 −0 man/geom_quantile.Rd
  79. +2 −0 man/geom_rect.Rd
  80. +2 −0 man/geom_ribbon.Rd
  81. +2 −0 man/geom_rug.Rd
  82. +2 −0 man/geom_segment.Rd
  83. +2 −0 man/geom_smooth.Rd
  84. +2 −0 man/geom_step.Rd
  85. +2 −0 man/geom_text.Rd
  86. +2 −0 man/geom_tile.Rd
  87. +2 −0 man/geom_vline.Rd
  88. +1 −0 man/position_dodge.Rd
  89. +1 −0 man/position_fill.Rd
  90. +1 −0 man/position_identity.Rd
  91. +1 −0 man/position_jitter.Rd
  92. +1 −0 man/position_stack.Rd
  93. +2 −0 man/stat_abline.Rd
  94. +2 −0 man/stat_bin.Rd
  95. +2 −0 man/stat_bin2d.Rd
  96. +2 −0 man/stat_binhex.Rd
  97. +2 −0 man/stat_boxplot.Rd
  98. +2 −0 man/stat_contour.Rd
  99. +3 −0 man/stat_density.Rd
  100. +3 −0 man/stat_density2d.Rd
  101. +2 −0 man/stat_function.Rd
  102. +2 −0 man/stat_hline.Rd
  103. +2 −0 man/stat_identity.Rd
  104. +2 −0 man/stat_qq.Rd
  105. +3 −0 man/stat_quantile.Rd
  106. +4 −0 man/stat_smooth.Rd
  107. +2 −0 man/stat_spoke.Rd
  108. +2 −0 man/stat_sum.Rd
  109. +2 −0 man/stat_summary.Rd
  110. +2 −0 man/stat_unique.Rd
  111. +2 −0 man/stat_vline.Rd
View
@@ -156,5 +156,4 @@ Collate:
'utilities.r'
'xxx-codegen.r'
'xxx-digest.r'
- 'xxx.r'
'zxx.r'
View
@@ -10,8 +10,7 @@
#' (\code{geom_abline(intercept=0, slope=1)}) then the line will be the same
#' in all panels. If the intercept and slope are stored in the data, then
#' they can vary from panel to panel. See the examples for more ideas.
-#'
-#' @name geom_abline
+#'
#' @seealso \code{\link{stat_smooth}} to add lines derived from the data,
#' \code{\link{geom_hline}} for horizontal lines,
#' \code{\link{geom_vline}} for vertical lines
@@ -49,6 +48,10 @@
#' # It's actually a bit easier to do this with stat_smooth
#' p + geom_smooth(aes(group=cyl), method="lm")
#' p + geom_smooth(aes(group=cyl), method="lm", fullrange=TRUE)
+geom_abline <- function (mapping = NULL, data = NULL, stat = "abline", position = "identity", ...) {
+ GeomAbline$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomAbline <- proto(Geom, {
objname <- "abline"
View
@@ -28,8 +28,7 @@
#' Naomi Robbins has a nice
#' \href{http://www.b-eye-network.com/view/index.php?cid=2468}{article on this topic}.
#' This is the reason it doesn't make sense to use a log-scaled y axis with a bar chart
-#'
-#' @name geom_bar
+#'
#' @seealso \code{\link{stat_bin}} for more details of the binning alogirithm,
#' \code{\link{position_dodge}} for creating side-by-side barcharts,
#' \code{\link{position_stack}} for more info on stacking,
@@ -103,6 +102,10 @@
#' "suv", "compact", "2seater", "subcompact", "pickup"))
#' m <- ggplot(mpg, aes(manufacturer, fill=class))
#' m + geom_bar()
+geom_bar <- function (mapping = NULL, data = NULL, stat = "bin", position = "stack", ...) {
+ GeomBar$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomBar <- proto(Geom, {
objname <- "bar"
View
@@ -9,7 +9,6 @@
#' may need to look at a few to uncover the full story behind your data.
#'
#'
-#' @name geom_histogram
#' @export
#' @examples
#' # Simple examples
@@ -104,6 +103,10 @@
#' # Which looks better when the distributions are more distinct
#' ggplot(diamonds, aes(depth, fill = cut)) +
#' geom_density(alpha = 0.2) + xlim(55, 70)
+geom_histogram <- function (mapping = NULL, data = NULL, stat = "bin", position = "stack", ...) {
+ GeomHistogram$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomHistogram <- proto(GeomBar, {
objname <- "histogram"
View
@@ -1,13 +1,16 @@
#' Add heatmap of 2d bin counts.
-#'
-#' @name geom_bin2d
+#'
#' @export
#' @examples
#' d <- ggplot(diamonds, aes(x = x, y = y)) + xlim(4,10) + ylim(4,10)
#' d + geom_bin2d()
#' d + geom_bin2d(binwidth = c(0.1, 0.1))
#'
#' # See ?stat_bin2d for more examples
+geom_bin2d <- function (mapping = NULL, data = NULL, stat = "bin2d", position = "identity", ...) {
+ GeomBin2d$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomBin2d <- proto(Geom, {
draw <- function(., data, scales, coordinates, ...) {
GeomRect$draw(data, scales, coordinates, ...)
View
@@ -3,11 +3,14 @@
#' The blank geom draws nothing, but can be a useful way of ensuring common
#' scales between different plots.
#'
-#' @name geom_blank
#' @export
#' @examples
#' qplot(length, rating, data=movies, geom="blank")
#' # Nothing to see here!
+geom_blank <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity", ...) {
+ GeomBlank$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomBlank <- proto(Geom, {
objname <- "blank"
View
@@ -1,6 +1,5 @@
#' Box and whiskers plot.
#'
-#' @name geom_boxplot
#' @seealso \code{\link{stat_quantile}} to view quantiles conditioned on a
#' continuous variable, \code{\link{geom_jitter}} for another way to look
#' at conditional distributions"
@@ -58,6 +57,13 @@
#' b + geom_boxplot(stat = "identity")
#' b + geom_boxplot(stat = "identity") + coord_flip()
#' b + geom_boxplot(aes(fill = X1), stat = "identity")
+geom_boxplot <- function (mapping = NULL, data = NULL, stat = "boxplot", position = "dodge",
+outlier.colour = "black", outlier.shape = 16, outlier.size = 2, ...) {
+ GeomBoxplot$new(mapping = mapping, data = data, stat = stat,
+ position = position, outlier.colour = outlier.colour, outlier.shape = outlier.shape,
+ outlier.size = outlier.size, ...)
+}
+
GeomBoxplot <- proto(Geom, {
objname <- "boxplot"
View
@@ -1,6 +1,5 @@
#' Hollow bar with middle indicated by horizontal line.
-#'
-#' @name geom_crossbar
+#'
#' @param fatten a multiplicate factor to fatten middle bar by
#' @seealso \code{\link{geom_errorbar}} for error bars,
#' \code{\link{geom_pointrange}} and \code{\link{geom_linerange}} for other
@@ -9,6 +8,12 @@
#' @export
#' @examples
#' # See geom_linerange for examples
+geom_crossbar <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity",
+fatten = 2, ...) {
+ GeomCrossbar$new(mapping = mapping, data = data, stat = stat,
+ position = position, fatten = fatten, ...)
+}
+
GeomCrossbar <- proto(Geom, {
objname <- "crossbar"
View
@@ -1,6 +1,5 @@
#' Error bars.
-#'
-#' @name geom_errorbar
+#'
#' @seealso \code{\link{geom_pointrange}}: range indicated by straight line,
#' with point in the middle; \code{\link{geom_linerange}}: range indicated
#' by straight line; \code{\link{geom_crossbar}}: hollow bar with middle
@@ -41,6 +40,10 @@
#' # groups which define the lines - here the groups in the
#' # original dataframe
#' p + geom_line(aes(group=group)) + geom_errorbar(limits, width=0.2)
+geom_errorbar <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity", ...) {
+ GeomErrorbar$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomErrorbar <- proto(Geom, {
objname <- "errorbar"
View
@@ -1,6 +1,5 @@
#' Horizontal error bars
-#'
-#' @name geom_errorbarh
+#'
#' @seealso \code{\link{geom_errorbar}}: vertical error bars
#' @param height height of errorbars
#' @export
@@ -19,6 +18,10 @@
#' geom_errorbarh(aes(xmax = resp + se, xmin = resp - se))
#' p + geom_point() +
#' geom_errorbarh(aes(xmax = resp + se, xmin = resp - se, height = .2))
+geom_errorbarh <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity", ...) {
+ GeomErrorbarh$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomErrorbarh <- proto(Geom, {
objname <- "errorbarh"
View
@@ -1,18 +1,21 @@
#' Frequency polygon.
#'
-#' @name geom_freqpoly
#' @seealso \code{\link{geom_histogram}}: histograms
#' @export
#' @examples
-#' qplot(carat, data = diamonds, geom="freqpoly")
-#' qplot(carat, data = diamonds, geom="freqpoly", binwidth = 0.1)
-#' qplot(carat, data = diamonds, geom="freqpoly", binwidth = 0.01)
+#' qplot(carat, data = diamonds, geom = "freqpoly")
+#' qplot(carat, data = diamonds, geom = "freqpoly", binwidth = 0.1)
+#' qplot(carat, data = diamonds, geom = "freqpoly", binwidth = 0.01)
#'
-#' qplot(price, data = diamonds, geom="freqpoly", binwidth = 1000)
-#' qplot(price, data = diamonds, geom="freqpoly", binwidth = 1000,
+#' qplot(price, data = diamonds, geom = "freqpoly", binwidth = 1000)
+#' qplot(price, data = diamonds, geom = "freqpoly", binwidth = 1000,
#' colour = color)
-#' qplot(price, ..density.., data = diamonds, geom="freqpoly",
+#' qplot(price, ..density.., data = diamonds, geom = "freqpoly",
#' binwidth = 1000, colour = color)
+geom_freqpoly <- function (mapping = NULL, data = NULL, stat = "bin", position = "identity", ...) {
+ GeomFreqpoly$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomFreqpoly <- proto(Geom, {
objname <- "freqpoly"
View
@@ -1,9 +1,12 @@
#' Hexagon bining.
-#'
-#' @name geom_hex
+#'
#' @export
#' @examples
#' # See ?stat_binhex for examples
+geom_hex <- function (mapping = NULL, data = NULL, stat = "binhex", position = "identity", ...) {
+ GeomHex$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomHex <- proto(Geom, {
objname <- "hex"
View
@@ -10,7 +10,6 @@
#' intercept for each panel using a data.frame. See the examples for the
#' differences
#'
-#' @name geom_hline
#' @seealso \code{\link{geom_vline}} for vertical lines,
#' \code{\link{geom_abline}} for lines defined by a slope and intercept,
#' \code{\link{geom_segment}} for a more general approach
@@ -28,6 +27,10 @@
#'
#' hline.data <- data.frame(z = 1:4, vs = c(0,0,1,1), am = c(0,1,0,1))
#' p + geom_hline(aes(yintercept = z), hline.data)
+geom_hline <- function (mapping = NULL, data = NULL, stat = "hline", position = "identity", ...) {
+ GeomHline$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomHline <- proto(Geom, {
objname <- "hline"
View
@@ -1,6 +1,5 @@
#' An interval represented by a vertical line.
#'
-#' @name geom_linerange
#' @seealso \code{\link{geom_errorbar}}: error bars;
#' \code{\link{geom_pointrange}}: range indicated by straight line, with
#' point in the middle; \code{\link{geom_crossbar}}: hollow bar with middle
@@ -28,6 +27,10 @@
#'
#' # Use coord_flip to flip the x and y axes
#' se + geom_linerange() + coord_flip()
+geom_linerange <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity", ...) {
+ GeomLinerange$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomLinerange <- proto(Geom, {
objname <- "linerange"
View
@@ -1,6 +1,5 @@
#' Connect observations in original order
#'
-#' @name geom_path
#' @param lineend Line end style (round, butt, square)
#' @param linejoin Line join style (round, mitre, bevel)
#' @param linemitre Line mitre limit (number greater than 1)
@@ -87,6 +86,12 @@
#' # Arrow defaults to "last"
#' c + geom_path(arrow = arrow())
#' c + geom_path(arrow = arrow(angle = 15, ends = "both", length = unit(0.6, "inches")))
+geom_path <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity",
+lineend = "butt", linejoin = "round", linemitre = 1, na.rm = FALSE, ...) {
+ GeomPath$new(mapping = mapping, data = data, stat = stat, position = position,
+ lineend = lineend, linejoin = linejoin, linemitre = linemitre, na.rm = na.rm, ...)
+}
+
GeomPath <- proto(Geom, {
objname <- "path"
View
@@ -1,10 +1,15 @@
#' Display contours of a 3d surface in 2d.
#'
-#' @name geom_contour
#' @seealso \code{\link{geom_density2d}}: 2d density contours
#' @export
#' @examples
#' # See stat_contour for examples
+geom_contour <- function (mapping = NULL, data = NULL, stat = "contour", position = "identity",
+lineend = "butt", linejoin = "round", linemitre = 1, na.rm = FALSE, ...) {
+ GeomContour$new(mapping = mapping, data = data, stat = stat, position = position,
+ lineend = lineend, linejoin = linejoin, linemitre = linemitre, na.rm = na.rm, ...)
+}
+
GeomContour <- proto(GeomPath, {
objname <- "contour"
View
@@ -4,13 +4,18 @@
#' results with contours.
#'
#' This can be useful for dealing with overplotting.
-#'
-#' @name geom_density2d
+#'
#' @seealso \code{\link{geom_contour}} for contour drawing geom,
#' \code{\link{stat_sum}} for another way of dealing with overplotting
#' @export
#' @examples
#' # See stat_density2d for examples
+geom_density2d <- function (mapping = NULL, data = NULL, stat = "density2d", position = "identity",
+lineend = "butt", linejoin = "round", linemitre = 1, na.rm = FALSE, ...) {
+ GeomDensity2d$new(mapping = mapping, data = data, stat = stat, position = position,
+ lineend = lineend, linejoin = linejoin, linemitre = linemitre, na.rm = na.rm, ...)
+}
+
GeomDensity2d <- proto(GeomPath, {
objname <- "density2d"
View
@@ -1,6 +1,5 @@
#' Connect observations, ordered by x value.
#'
-#' @name geom_line
#' @seealso \code{\link{geom_path}}: connect observations in data order,
#' \code{\link{geom_segment}}: draw line segments,
#' \code{\link{geom_ribbon}}: fill between line and x-axis
@@ -56,6 +55,10 @@
#' dfm <- melt(df, id.var = c("id", "group"))
#' ggplot(dfm, aes(variable, value, group = id, colour = group)) +
#' geom_path(alpha = 0.5)
+geom_line <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity", ...) {
+ GeomLine$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomLine <- proto(GeomPath, {
objname <- "line"
View
@@ -1,6 +1,5 @@
#' Connect observations by stairs.
#'
-#' @name geom_step
#' @param direction direction of stairs: 'vh' for vertical then horizontal, or
#' 'hv' for horizontal then vertical
#' @export
@@ -22,6 +21,12 @@
#' trt = sample(c("a", "b"), 50, rep = T)
#' )
#' qplot(seq_along(x), x, data = df, geom="step", colour = trt)
+geom_step <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity",
+direction = "hv", ...) {
+ GeomStep$new(mapping = mapping, data = data, stat = stat, position = position,
+ direction = direction, ...)
+}
+
GeomStep <- proto(Geom, {
objname <- "step"
View
@@ -4,7 +4,6 @@
#' 'jitter'. See \code{\link{position_jitter}} to see how to adjust amount
#' of jittering.
#'
-#' @name geom_jitter
#' @seealso
#' \code{\link{geom_point}} for regular, unjittered points,
#' \code{\link{geom_boxplot}} for another way of looking at the conditional
@@ -28,6 +27,12 @@
#' qplot(mpaa, rating, data=movies, geom="jitter")
#' qplot(mpaa, rating, data=movies, geom=c("boxplot","jitter"))
#' qplot(mpaa, rating, data=movies, geom=c("jitter", "boxplot"))
+geom_jitter <- function (mapping = NULL, data = NULL, stat = "identity", position = "jitter",
+na.rm = FALSE, ...) {
+ GeomJitter$new(mapping = mapping, data = data, stat = stat, position = position,
+ na.rm = na.rm, ...)
+}
+
GeomJitter <- proto(GeomPoint, {
objname <- "jitter"
View
@@ -1,6 +1,5 @@
#' An interval represented by a vertical line, with a point in the middle.
#'
-#' @name geom_pointrange
#' @seealso
#' \code{\link{geom_errorbar}} for error bars,
#' \code{\link{geom_linerange}} for range indicated by straight line, + examples,
@@ -10,6 +9,10 @@
#' @export
#' @examples
#' # See geom_linerange for examples
+geom_pointrange <- function (mapping = NULL, data = NULL, stat = "identity", position = "identity", ...) {
+ GeomPointrange$new(mapping = mapping, data = data, stat = stat, position = position, ...)
+}
+
GeomPointrange <- proto(Geom, {
objname <- "pointrange"
Oops, something went wrong.

0 comments on commit ede677c

Please sign in to comment.