Browse Source

compiled with new na.rm policy in ggplot2

tags/v0.1.1
hrbrmstr 9 years ago
parent
commit
adbe50e963
  1. 26
      DESCRIPTION
  2. 2
      NAMESPACE
  3. 3
      R/geom_ash.r
  4. 17
      R/geom_bkde.r
  5. 6
      R/geom_bkde2d.r
  6. 8
      R/geom_xspline.r
  7. 2
      README.Rmd
  8. 10
      README.md
  9. BIN
      README_figs/README-bkde_ash-5.png
  10. BIN
      README_figs/README-coord_proj-1.png
  11. BIN
      README_figs/README-splines-3.png
  12. BIN
      README_figs/README-splines-4.png
  13. BIN
      README_figs/README-splines-5.png
  14. BIN
      README_figs/README-splines-6.png
  15. BIN
      README_figs/README-splines-7.png
  16. BIN
      README_figs/README-splines-8.png
  17. 2
      man/absoluteGrob.Rd
  18. 2
      man/coord_proj.Rd
  19. 11
      man/geom_bkde.Rd
  20. 9
      man/geom_bkde2d.Rd
  21. 20
      man/geom_xspline.Rd
  22. 2
      man/ggalt-ggproto.Rd
  23. 2
      man/ggalt.Rd
  24. 9
      man/stat_ash.Rd

26
DESCRIPTION

@ -1,12 +1,26 @@
Package: ggalt
Title: Alternate/Extra 'Geoms', 'Stats' and 'Coords' for 'ggplot2'
Version: 0.0.3.9000
Version: 0.0.4.9000
Authors@R: c(person("Bob", "Rudis", email = "bob@rudis.net", role = c("aut", "cre")))
Description: A package containing additional/alternate 'geoms', 'coords' and 'stats'
for use with the revamped (late 2015) version of ggplot2.
Depends: R (>= 3.0.0), ggplot2 (>= 1.0.1.9003)
Description: A package containing additional/alternate 'geoms', 'coords' and
'stats' for use with the revamped (late 2015) version of ggplot2.
Depends:
R (>= 3.0.0),
ggplot2 (>= 1.0.1.9003)
License: AGPL + file LICENSE
LazyData: true
Suggests: testthat, gridExtra
Suggests:
testthat,
gridExtra
Encoding: UTF-8
Imports: graphics, grDevices, dplyr, KernSmooth, proj4, scales, grid, gtable, ash
Imports:
graphics,
grDevices,
dplyr,
KernSmooth,
proj4,
scales,
grid,
gtable,
ash
RoxygenNote: 5.0.0

2
NAMESPACE

@ -1,4 +1,4 @@
# Generated by roxygen2 (4.1.1): do not edit by hand
# Generated by roxygen2: do not edit by hand
S3method(grid.draw,absoluteGrob)
S3method(grobHeight,absoluteGrob)

3
R/geom_ash.r

@ -57,7 +57,7 @@
stat_ash <- function(mapping = NULL, data = NULL, geom = "area",
position = "stack",
ab = NULL, nbin = 50, m = 5, kopt = c(2, 2),
show.legend = NA, inherit.aes = TRUE, ...) {
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...) {
layer(
data = data,
@ -68,6 +68,7 @@ stat_ash <- function(mapping = NULL, data = NULL, geom = "area",
show.legend = show.legend,
inherit.aes = inherit.aes,
params = list(
na.rm = na.rm,
ab = ab,
nbin = nbin,
m = m,

17
R/geom_bkde.r

@ -15,17 +15,16 @@
#' \item \code{linetype}
#' \item \code{size}
#' }
#'
#' @inheritParams ggplot2::geom_point
#' @param geom,stat Use to override the default connection between
#' \code{geom_bkde} and \code{stat_bkde}.
#' @seealso See \code{\link{geom_histogram}}, \code{\link{geom_freqpoly}} for
#' other methods of displaying continuous distribution.
#' See \code{\link{geom_violin}} for a compact density display.
#' @inheritParams ggplot2::geom_point
#' @export
geom_bkde <- function(mapping = NULL, data = NULL, stat = "bkde",
position = "identity", bandwidth=NULL, range.x=NULL,
show.legend = NA, inherit.aes = TRUE,
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE,
...) {
layer(
@ -38,6 +37,7 @@ geom_bkde <- function(mapping = NULL, data = NULL, stat = "bkde",
inherit.aes = inherit.aes,
params = list(bandwidth=bandwidth,
range.x=range.x,
na.rm=na.rm,
...)
)
}
@ -93,7 +93,7 @@ GeomBkde <- ggproto("GeomBkde", GeomArea,
stat_bkde <- function(mapping = NULL, data = NULL, geom = "area",
position = "stack", kernel="normal", canonical=FALSE,
bandwidth = NULL, gridsize=410, range.x=NULL,
truncate=TRUE, show.legend = NA, inherit.aes = TRUE,
truncate=TRUE, na.rm=FALSE, show.legend = NA, inherit.aes = TRUE,
...) {
layer(
@ -111,6 +111,7 @@ stat_bkde <- function(mapping = NULL, data = NULL, geom = "area",
gridsize=gridsize,
range.x=range.x,
truncate=truncate,
na.rm=na.rm,
...
)
)
@ -129,7 +130,7 @@ StatBkde <- ggproto("StatBkde", Stat,
compute_group = function(data, scales, kernel="normal", canonical=FALSE,
bandwidth=NULL, gridsize=410, range.x=NULL,
truncate=TRUE) {
truncate=TRUE, na.rm = TRUE) {
# KernSmooth::dpik uses a generated normal distribution as part of it's
# operation but doesn't do this seed save/create/restore. When bandwidth
@ -152,14 +153,14 @@ StatBkde <- ggproto("StatBkde", Stat,
compute_bkde(data$x, kernel=kernel, canonical=canonical,
bandwidth=bandwidth, gridsize=gridsize, range.x=range.x,
truncate=truncate)
truncate=truncate, na.rm)
}
)
compute_bkde <- function(x, kernel="normal", canonical=FALSE,
bandwidth, gridsize=410, range.x, truncate=TRUE) {
bandwidth, gridsize=410, range.x, truncate=TRUE, na.rm=TRUE) {
n <- length(x)
@ -170,7 +171,7 @@ compute_bkde <- function(x, kernel="normal", canonical=FALSE,
data.frame(
x = dens$x,
density = dens$y,
scaled = dens$y / max(dens$y, na.rm = TRUE),
scaled = dens$y / max(dens$y, na.rm = na.rm),
count = dens$y * n,
n = n
)

6
R/geom_bkde2d.r

@ -32,7 +32,7 @@ geom_bkde2d <- function(mapping = NULL, data = NULL, stat = "bkde2d",
position = "identity", bandwidth=NULL, range.x=NULL,
lineend = "butt", contour=TRUE,
linejoin = "round", linemitre = 1,
show.legend = NA,
na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...) {
layer(
data = data,
@ -48,6 +48,7 @@ geom_bkde2d <- function(mapping = NULL, data = NULL, stat = "bkde2d",
linemitre = linemitre,
bandwidth = bandwidth,
range.x = range.x,
na.rm = na.rm,
...
)
)
@ -92,7 +93,7 @@ GeomBkde2d <- ggproto("GeomBkde2d", GeomPath,
stat_bkde2d <- function(mapping = NULL, data = NULL, geom = "density2d",
position = "identity", contour = TRUE,
bandwidth=NULL, grid_size=c(51, 51), range.x=NULL,
truncate=TRUE, show.legend = NA,
truncate=TRUE, na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...) {
layer(
data = data,
@ -108,6 +109,7 @@ stat_bkde2d <- function(mapping = NULL, data = NULL, geom = "density2d",
range.x = range.x,
truncate = truncate,
contour = contour,
na.rm = na.rm,
...
)
)

8
R/geom_xspline.r

@ -108,8 +108,8 @@
#' geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
#' geom_xspline(spline_shape=-1, size=0.5)
geom_xspline <- function(mapping = NULL, data = NULL, stat = "xspline",
position = "identity", show.legend = NA,
inherit.aes = TRUE, na.rm = TRUE,
position = "identity", na.rm = TRUE, show.legend = NA,
inherit.aes = TRUE,
spline_shape=-0.25, open=TRUE, rep_ends=TRUE, ...) {
layer(
geom = GeomXspline,
@ -121,6 +121,7 @@ geom_xspline <- function(mapping = NULL, data = NULL, stat = "xspline",
inherit.aes = inherit.aes,
params = list(spline_shape=spline_shape,
open=open,
na.rm = na.rm,
rep_ends=rep_ends,
...)
)
@ -147,7 +148,7 @@ GeomXspline <- ggproto("GeomXspline", GeomLine,
#' \item{y}
#' }
stat_xspline <- function(mapping = NULL, data = NULL, geom = "line",
position = "identity", show.legend = NA, inherit.aes = TRUE,
position = "identity", na.rm = TRUE, show.legend = NA, inherit.aes = TRUE,
spline_shape=-0.25, open=TRUE, rep_ends=TRUE, ...) {
layer(
stat = StatXspline,
@ -159,6 +160,7 @@ stat_xspline <- function(mapping = NULL, data = NULL, geom = "line",
inherit.aes = inherit.aes,
params = list(spline_shape=spline_shape,
open=open,
na.rm = na.rm,
rep_ends=rep_ends,
...
)

2
README.Rmd

@ -10,7 +10,7 @@ output:
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.retina = 2,
fig.retina = 2,
fig.path = "README_figs/README-"
)
```

10
README.md

@ -45,7 +45,7 @@ library(ggalt)
# current verison
packageVersion("ggalt")
#> [1] '0.0.3.9000'
#> [1] '0.0.4.9000'
set.seed(1492)
dat <- data.frame(x=c(1:10, 1:10, 1:10),
@ -256,6 +256,10 @@ ggplot(geyser_dat, aes(x, y)) +
``` r
# devtools::install_github("hrbrmstr/ggplot2")
world <- map_data("world")
#>
#> # ATTENTION: maps v3.0 has an updated 'world' map. #
#> # Many country borders and names have changed since 1990. #
#> # Type '?world' or 'news(package="maps")'. See README_v3. #
world <- world[world$region != "Antarctica",]
gg <- ggplot()
@ -274,13 +278,11 @@ library(ggalt)
library(testthat)
date()
#> [1] "Sun Sep 13 07:33:03 2015"
#> [1] "Sat Oct 31 10:07:15 2015"
test_dir("tests/")
#> testthat results ========================================================================================================
#> OK: 0 SKIPPED: 0 FAILED: 0
#>
#> DONE
```
### Code of Conduct

BIN
README_figs/README-bkde_ash-5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

BIN
README_figs/README-coord_proj-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 184 KiB

BIN
README_figs/README-splines-3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 137 KiB

BIN
README_figs/README-splines-4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 137 KiB

BIN
README_figs/README-splines-5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 133 KiB

BIN
README_figs/README-splines-6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 131 KiB

BIN
README_figs/README-splines-7.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 136 KiB

BIN
README_figs/README-splines-8.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 138 KiB

2
man/absoluteGrob.Rd

@ -1,4 +1,4 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/grob_absolute.r
\name{absoluteGrob}
\alias{absoluteGrob}

2
man/coord_proj.Rd

@ -1,4 +1,4 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/coord_proj.r
\name{coord_proj}
\alias{coord_proj}

11
man/geom_bkde.Rd

@ -1,4 +1,4 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom_bkde.r
\name{geom_bkde}
\alias{geom_bkde}
@ -7,12 +7,12 @@
\usage{
geom_bkde(mapping = NULL, data = NULL, stat = "bkde",
position = "identity", bandwidth = NULL, range.x = NULL,
show.legend = NA, inherit.aes = TRUE, ...)
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
stat_bkde(mapping = NULL, data = NULL, geom = "area",
position = "stack", kernel = "normal", canonical = FALSE,
bandwidth = NULL, gridsize = 410, range.x = NULL, truncate = TRUE,
show.legend = NA, inherit.aes = TRUE, ...)
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link{aes}} or
@ -35,6 +35,9 @@ results.}
\item{range.x}{vector containing the minimum and maximum values of x at which
to compute the estimate. see \code{\link[KernSmooth]{bkde}} for details}
\item{na.rm}{If \code{FALSE} (the default), removes missing values with
a warning. If \code{TRUE} silently removes missing values.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.}
@ -55,7 +58,7 @@ the default plot specification, e.g. \code{\link{borders}}.}
\item Other arguments passed on to the stat.
}}
\item{geom,stat}{Use to override the default connection between
\item{geom, stat}{Use to override the default connection between
\code{geom_bkde} and \code{stat_bkde}.}
\item{kernel}{character string which determines the smoothing kernel. see

9
man/geom_bkde2d.Rd

@ -1,4 +1,4 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom_bkde2d.r
\name{geom_bkde2d}
\alias{geom_bkde2d}
@ -8,11 +8,11 @@
geom_bkde2d(mapping = NULL, data = NULL, stat = "bkde2d",
position = "identity", bandwidth = NULL, range.x = NULL,
lineend = "butt", contour = TRUE, linejoin = "round", linemitre = 1,
show.legend = NA, inherit.aes = TRUE, ...)
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
stat_bkde2d(mapping = NULL, data = NULL, geom = "density2d",
position = "identity", contour = TRUE, bandwidth = NULL,
grid_size = c(51, 51), range.x = NULL, truncate = TRUE,
grid_size = c(51, 51), range.x = NULL, truncate = TRUE, na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE, ...)
}
\arguments{
@ -49,6 +49,9 @@ estimation}
\item{linemitre}{Line mitre limit (number greater than 1)}
\item{na.rm}{If \code{FALSE} (the default), removes missing values with
a warning. If \code{TRUE} silently removes missing values.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.}

20
man/geom_xspline.Rd

@ -1,4 +1,4 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom_xspline.r
\name{geom_xspline}
\alias{geom_xspline}
@ -6,12 +6,14 @@
\title{Connect control points/observations with an X-spline}
\usage{
geom_xspline(mapping = NULL, data = NULL, stat = "xspline",
position = "identity", show.legend = NA, inherit.aes = TRUE,
na.rm = TRUE, spline_shape = -0.25, open = TRUE, rep_ends = TRUE, ...)
position = "identity", na.rm = TRUE, show.legend = NA,
inherit.aes = TRUE, spline_shape = -0.25, open = TRUE,
rep_ends = TRUE, ...)
stat_xspline(mapping = NULL, data = NULL, geom = "line",
position = "identity", show.legend = NA, inherit.aes = TRUE,
spline_shape = -0.25, open = TRUE, rep_ends = TRUE, ...)
position = "identity", na.rm = TRUE, show.legend = NA,
inherit.aes = TRUE, spline_shape = -0.25, open = TRUE,
rep_ends = TRUE, ...)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link{aes}} or
@ -26,6 +28,9 @@ defined at the top level of the plot.}
\item{position}{Position adjustment, either as a string, or the result of
a call to a position adjustment function.}
\item{na.rm}{If \code{FALSE} (the default), removes missing values with
a warning. If \code{TRUE} silently removes missing values.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.}
@ -35,9 +40,6 @@ rather than combining with them. This is most useful for helper functions
that define both data and aesthetics and shouldn't inherit behaviour from
the default plot specification, e.g. \code{\link{borders}}.}
\item{na.rm}{If \code{FALSE} (the default), removes missing values with
a warning. If \code{TRUE} silently removes missing values.}
\item{spline_shape}{A numeric vector of values between -1 and 1, which
control the shape of the spline relative to the control points.}
@ -59,7 +61,7 @@ curve. Ignored for closed X-splines.}
\item Other arguments passed on to the stat.
}}
\item{geom,stat}{Use to override the default connection between
\item{geom, stat}{Use to override the default connection between
\code{geom_xspline} and \code{stat_xspline}.}
}
\description{

2
man/ggalt-ggproto.Rd

@ -1,4 +1,4 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom_bkde.r, R/geom_bkde2d.r, R/geom_xspline.r
\docType{data}
\name{GeomBkde}

2
man/ggalt.Rd

@ -1,4 +1,4 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ggalt-package.r
\docType{package}
\name{ggalt}

9
man/stat_ash.Rd

@ -1,12 +1,12 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom_ash.r
\name{stat_ash}
\alias{stat_ash}
\title{Compute and display a univariate averaged shifted histogram (polynomial kernel)}
\usage{
stat_ash(mapping = NULL, data = NULL, geom = "area", position = "stack",
ab = NULL, nbin = 50, m = 5, kopt = c(2, 2), show.legend = NA,
inherit.aes = TRUE, ...)
ab = NULL, nbin = 50, m = 5, kopt = c(2, 2), na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE, ...)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link{aes}} or
@ -35,6 +35,9 @@ interval.}
to \emph{( 1 - abs(i/m)^kopt(1) )i^kopt(2)}; (2,2)=biweight (default);
(0,0)=uniform; (1,0)=triangle; (2,1)=Epanechnikov; (2,3)=triweight.}
\item{na.rm}{If \code{FALSE} (the default), removes missing values with
a warning. If \code{TRUE} silently removes missing values.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.}

Loading…
Cancel
Save