diff --git a/DESCRIPTION b/DESCRIPTION index 344b912d..4f634d91 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: animint Maintainer: Toby Dylan Hocking Author: Toby Dylan Hocking, Susan VanderPlas, Carson Sievert, Kevin Ferris, Tony Tsai, Faizan Khan -Version: 2016.11.02 +Version: 2016.11.03 License: GPL-3 Title: Interactive animations Description: An interactive animation can be defined using a list of diff --git a/NAMESPACE b/NAMESPACE index bd81e2d0..faf1faa7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,16 +1,21 @@ +# Generated by roxygen2: do not edit by hand + +export(animint) export(animint2dir) export(animint2gist) export(animintOutput) export(geom_tallrect) export(geom_widerect) export(getLegendList) +export(gg2animint) export(is.rgb) export(knit_print.animint) -export(print.animint) export(makeDocs) export(make_bar) export(make_tallrect) +export(make_tallrect_or_widerect) export(make_text) +export(make_widerect) export(parsePlot) export(renderAnimint) export(saveLayer) diff --git a/NEWS b/NEWS index f3de51bd..40e4a834 100644 --- a/NEWS +++ b/NEWS @@ -180,6 +180,11 @@ RENDER: multiple animints inside of a single shiny app? This is probably just a theoretical issue. (why not just make a single animint?) +2016.11.03 PR#171 + +DSL: animint(...) can now be used as an abbreviation of +structure(list(...),class="animint"). + 2016.11.02 PR#169 OPTIMIZATION: some un-necessary code was deleted in a cleanup effort diff --git a/R/animint.R b/R/animint.R index c5560ccd..99a497e4 100644 --- a/R/animint.R +++ b/R/animint.R @@ -1,3 +1,14 @@ +##' Create a new animint, which is a list of ggplots and options that +##' has class "animint" +##' @title animint +##' @param ... passed to list +##' @return a list of class "animint" +##' @export +##' @author Toby Dylan Hocking +animint <- function(...){ + structure(list(...), class="animint") +} + #' Convert a ggplot to a list. #' @param meta environment with previously calculated plot data, and a new plot to parse, already stored in plot and plot.name. #' @return nothing, info is stored in meta. @@ -1303,7 +1314,6 @@ gg2animint <- function(...){ #' \item shape. Open and closed circles can be represented by manipulating fill and colour scales and using default (circle) points, but d3 does not support many R shape types, so mapping between the two is difficult. #' } #' -#' @aliases animint #' @param plot.list a named list of ggplots and option lists. #' @param out.dir directory to store html/js/csv files. #' @param json.file character string that names the JSON file with metadata associated with the plot. diff --git a/README.md b/README.md index 6a23821f..8d0eee5b 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,7 @@ NOTE: animint now works with standard ggplot2 >= 2.0 thanks to [chunk\_vars option](https://github.com/tdhock/animint/wiki/Advanced-features-present-animint-but-not-in-ggplot2#use-chunk_varscvar1-var2-to-specify-how-much-data-to-load-at-a-time) then you will need to install -[faizan-khan-iit/ggplot2@validate-params](https://github.com/hadley/ggplot2/pull/1649) -until the ggplot2 developers [resolve the -issue](https://github.com/hadley/ggplot2/issues/1694). +[faizan-khan-iit/ggplot2@validate-params](https://github.com/hadley/ggplot2/pull/1649). ## Learning animint through examples diff --git a/inst/examples/WorldBank-facets.R b/inst/examples/WorldBank-facets.R index f5909cfe..1d4d1432 100644 --- a/inst/examples/WorldBank-facets.R +++ b/inst/examples/WorldBank-facets.R @@ -3,7 +3,7 @@ data(WorldBank) not.na <- subset(WorldBank, !(is.na(life.expectancy) | is.na(fertility.rate))) subset(not.na, is.na(not.na$population)) subset(not.na, country == "Kuwait" & 1991 <= year & year <= 1995) -not.na[not.na$country=="Kuwait", "population"] <- 1700000 +not.na[is.na(not.na$population), "population"] <- 1700000 BOTH <- function(df, top, side){ data.frame(df, top=factor(top, c("Fertility rate", "Years")), diff --git a/inst/examples/test_knit_print.Rmd b/inst/examples/test_knit_print.Rmd index e0285982..7c43d506 100644 --- a/inst/examples/test_knit_print.Rmd +++ b/inst/examples/test_knit_print.Rmd @@ -18,9 +18,9 @@ knit_meta() library(ggplot2) library(animint) dat <- data.frame(x = 1:10, y = 1:10, label = rep(c("a178", "b934"), 5)) -q2 <- list(q = qplot(x, y, data = dat, colour = label, - xlab = "first plot with color legend")) -structure(q2, class = "animint") +animint(q = qplot( + x, y, data = dat, colour = label, + xlab = "first plot with color legend")) ``` Clicking on the plot above should not affect the plot below. diff --git a/man/animint.Rd b/man/animint.Rd new file mode 100644 index 00000000..23eff024 --- /dev/null +++ b/man/animint.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/animint.R +\name{animint} +\alias{animint} +\title{animint} +\usage{ +animint(...) +} +\arguments{ +\item{...}{passed to list} +} +\value{ +a list of class "animint" +} +\description{ +Create a new animint, which is a list of ggplots and options that +has class "animint" +} +\author{ +Toby Dylan Hocking +} + diff --git a/man/animint2dir.Rd b/man/animint2dir.Rd index 8545e11d..c93f868e 100644 --- a/man/animint2dir.Rd +++ b/man/animint2dir.Rd @@ -1,7 +1,6 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand +% Generated by roxygen2: do not edit by hand % Please edit documentation in R/animint.R \name{animint2dir} -\alias{animint} \alias{animint2dir} \title{Compile and render an animint in a local directory} \usage{ diff --git a/man/animint2gist.Rd b/man/animint2gist.Rd index 4880dc58..1e360d79 100644 --- a/man/animint2gist.Rd +++ b/man/animint2gist.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/gist.R \name{animint2gist} \alias{animint2gist} diff --git a/man/animintOutput.Rd b/man/animintOutput.Rd index 9d258a75..5d0b368c 100644 --- a/man/animintOutput.Rd +++ b/man/animintOutput.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/knitr.R \name{animintOutput} \alias{animintOutput} diff --git a/man/geom_tallrect.Rd b/man/geom_tallrect.Rd index 97e3201d..0201c861 100644 --- a/man/geom_tallrect.Rd +++ b/man/geom_tallrect.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/geoms.R \name{geom_tallrect} \alias{geom_tallrect} diff --git a/man/geom_widerect.Rd b/man/geom_widerect.Rd index e155ae50..3cda76cd 100644 --- a/man/geom_widerect.Rd +++ b/man/geom_widerect.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/geoms.R \name{geom_widerect} \alias{geom_widerect} @@ -26,7 +26,7 @@ ggplot2 layer ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements. } \examples{ -\dontrun{ + \dontrun{ source(system.file("examples/WorldBank.R", package = "animint")) } } diff --git a/man/getCommonChunk.Rd b/man/getCommonChunk.Rd index a01ba9f2..28bcf118 100644 --- a/man/getCommonChunk.Rd +++ b/man/getCommonChunk.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/animint.R \name{getCommonChunk} \alias{getCommonChunk} diff --git a/man/getLegend.Rd b/man/getLegend.Rd index af679e01..4cc58e42 100644 --- a/man/getLegend.Rd +++ b/man/getLegend.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/animint.R \name{getLegend} \alias{getLegend} diff --git a/man/getLegendList.Rd b/man/getLegendList.Rd index 1bb7f517..df6dc310 100644 --- a/man/getLegendList.Rd +++ b/man/getLegendList.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/animint.R \name{getLegendList} \alias{getLegendList} diff --git a/man/gg2animint.Rd b/man/gg2animint.Rd index 73dc1480..7b4c08e8 100644 --- a/man/gg2animint.Rd +++ b/man/gg2animint.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/animint.R \name{gg2animint} \alias{gg2animint} diff --git a/man/is.rgb.Rd b/man/is.rgb.Rd index dd54b06f..4241ab55 100644 --- a/man/is.rgb.Rd +++ b/man/is.rgb.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/animint.R \name{is.rgb} \alias{is.rgb} diff --git a/man/knit_print.animint.Rd b/man/knit_print.animint.Rd index d583bfd4..4030594c 100644 --- a/man/knit_print.animint.Rd +++ b/man/knit_print.animint.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/knitr.R \name{knit_print.animint} \alias{knit_print.animint} diff --git a/man/makeDocs.Rd b/man/makeDocs.Rd index e101d208..c08b395a 100644 --- a/man/makeDocs.Rd +++ b/man/makeDocs.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/doc.R \name{makeDocs} \alias{makeDocs} diff --git a/man/make_bar.Rd b/man/make_bar.Rd index a555e7e3..e94ca56e 100644 --- a/man/make_bar.Rd +++ b/man/make_bar.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/geoms.R \name{make_bar} \alias{make_bar} diff --git a/man/make_tallrect.Rd b/man/make_tallrect.Rd index d10af7db..96cc6e54 100644 --- a/man/make_tallrect.Rd +++ b/man/make_tallrect.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/geoms.R \name{make_tallrect} \alias{make_tallrect} diff --git a/man/make_tallrect_or_widerect.Rd b/man/make_tallrect_or_widerect.Rd index 18b83731..9dc36171 100644 --- a/man/make_tallrect_or_widerect.Rd +++ b/man/make_tallrect_or_widerect.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/geoms.R \name{make_tallrect_or_widerect} \alias{make_tallrect_or_widerect} diff --git a/man/make_text.Rd b/man/make_text.Rd index 435e2d28..46ae177e 100644 --- a/man/make_text.Rd +++ b/man/make_text.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/geoms.R \name{make_text} \alias{make_text} diff --git a/man/make_widerect.Rd b/man/make_widerect.Rd index fefd6f91..dd1eaf4e 100644 --- a/man/make_widerect.Rd +++ b/man/make_widerect.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/geoms.R \name{make_widerect} \alias{make_widerect} diff --git a/man/merge_recurse.Rd b/man/merge_recurse.Rd index d8cdae46..628e649b 100644 --- a/man/merge_recurse.Rd +++ b/man/merge_recurse.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/animint.R \name{merge_recurse} \alias{merge_recurse} diff --git a/man/parsePlot.Rd b/man/parsePlot.Rd index 1bb5f584..3eabd068 100644 --- a/man/parsePlot.Rd +++ b/man/parsePlot.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/animint.R \name{parsePlot} \alias{parsePlot} diff --git a/man/renderAnimint.Rd b/man/renderAnimint.Rd index 129a5f54..376975a4 100644 --- a/man/renderAnimint.Rd +++ b/man/renderAnimint.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/knitr.R \name{renderAnimint} \alias{renderAnimint} @@ -11,11 +11,11 @@ renderAnimint(expr, env = parent.frame(), quoted = FALSE) \item{env}{The environment in which to evaluate \code{expr}.} -\item{quoted}{Is expr a quoted expression (with \code{quote()})? +\item{quoted}{Is expr a quoted expression (with \code{quote()})? This is useful if you want to save an expression in a variable.} } \description{ -Shiny server output function customized for animint plots +Shiny server output function customized for animint plots (similar to \code{shiny::plotOutput} and friends). } \seealso{ diff --git a/man/run_servr.Rd b/man/run_servr.Rd index 0e99c5e8..4cc1c3b6 100644 --- a/man/run_servr.Rd +++ b/man/run_servr.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/testHelpers.R \name{run_servr} \alias{run_servr} diff --git a/man/saveChunks.Rd b/man/saveChunks.Rd index a19e6d76..5f6f88bb 100644 --- a/man/saveChunks.Rd +++ b/man/saveChunks.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/animint.R \name{saveChunks} \alias{saveChunks} diff --git a/man/saveLayer.Rd b/man/saveLayer.Rd index ef8a0766..8b8999ae 100644 --- a/man/saveLayer.Rd +++ b/man/saveLayer.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/animint.R \name{saveLayer} \alias{saveLayer} diff --git a/man/scale_size_animint.Rd b/man/scale_size_animint.Rd index bfa34726..d1737ca4 100644 --- a/man/scale_size_animint.Rd +++ b/man/scale_size_animint.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/scales.R \name{scale_size_animint} \alias{scale_size_animint} diff --git a/man/selector.aes.Rd b/man/selector.aes.Rd index db44cd21..9b1e002a 100644 --- a/man/selector.aes.Rd +++ b/man/selector.aes.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/animint.R \name{selector.aes} \alias{selector.aes} diff --git a/man/split.x.Rd b/man/split.x.Rd index 4a2a7ea4..3436d369 100644 --- a/man/split.x.Rd +++ b/man/split.x.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/animint.R \name{split.x} \alias{split.x} diff --git a/man/tests_exit.Rd b/man/tests_exit.Rd index 7a23bd4d..1300de2e 100644 --- a/man/tests_exit.Rd +++ b/man/tests_exit.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/testHelpers.R \name{tests_exit} \alias{tests_exit} diff --git a/man/tests_init.Rd b/man/tests_init.Rd index 37a0c9b2..26e04f78 100644 --- a/man/tests_init.Rd +++ b/man/tests_init.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/testHelpers.R \name{tests_init} \alias{tests_init} diff --git a/man/tests_run.Rd b/man/tests_run.Rd index e416bb2c..9f617efb 100644 --- a/man/tests_run.Rd +++ b/man/tests_run.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/testHelpers.R \name{tests_run} \alias{tests_run} @@ -17,6 +17,7 @@ file name after it has been stripped of "test-" and ".r".} Convenience function for running animint tests. } \examples{ + \dontrun{ # run tests in test-rotate.R with Firefox tests_init("firefox") @@ -24,5 +25,6 @@ tests_run(filter = "rotate") # clean-up tests_exit() } + } diff --git a/man/theme_animint.Rd b/man/theme_animint.Rd index dcac3d28..44f9b5a8 100644 --- a/man/theme_animint.Rd +++ b/man/theme_animint.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/theme.R \name{theme_animint} \alias{theme_animint} diff --git a/man/toRGB.Rd b/man/toRGB.Rd index 5f9cc51b..8a22f433 100644 --- a/man/toRGB.Rd +++ b/man/toRGB.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/animint.R \name{toRGB} \alias{toRGB} diff --git a/man/transform_shape.Rd b/man/transform_shape.Rd index c60a7ac8..7f8d2faf 100644 --- a/man/transform_shape.Rd +++ b/man/transform_shape.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/transformShape.R \name{transform_shape} \alias{transform_shape} diff --git a/man/varied.chunk.Rd b/man/varied.chunk.Rd index 44cda51b..fb936ccb 100644 --- a/man/varied.chunk.Rd +++ b/man/varied.chunk.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/animint.R \name{varied.chunk} \alias{varied.chunk}