Skip to content

Commit

Permalink
Eliminate slow examples
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Aug 27, 2015
1 parent 61b04c7 commit f4bf9d2
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/compute-collect.r
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#' takes a local data frame and makes it available to the remote source.
#' @export
#' @examples
#' \donttest{
#' if (require("RSQLite") && has_lahman("sqlite")) {
#' batting <- tbl(lahman_sqlite(), "Batting")
#' remote <- select(filter(batting, yearID > 2010 && stint == 1), playerID:H)
#' \donttest{
#' remote2 <- collapse(remote)
#' cached <- compute(remote)
#' local <- collect(remote)
Expand Down
2 changes: 2 additions & 0 deletions R/data-lahman.r
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#' @keywords internal
#' @examples
#' # Connect to a local sqlite database, if already created
#' \donttest{
#' if (has_lahman("sqlite")) {
#' lahman_sqlite()
#' batting <- tbl(lahman_sqlite(), "Batting")
Expand All @@ -28,6 +29,7 @@
#' lahman_postgres()
#' batting <- tbl(lahman_postgres(), "Batting")
#' }
#' }
#' @name lahman
NULL

Expand Down
2 changes: 2 additions & 0 deletions R/explain.r
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#' @param x An object to explain
#' @param ... Other parameters possibly used by generic
#' @examples
#' \donttest{
#' if (require("RSQLite") && has_lahman("sqlite")) {
#'
#' lahman_s <- lahman_sqlite()
Expand All @@ -32,6 +33,7 @@
#' teams <- tbl(lahman_s, "Teams")
#' batting %>% left_join(teams, c("yearID", "teamID")) %>% explain()
#' }
#' }
explain <- function(x, ...) {
UseMethod("explain")
}
Expand Down
2 changes: 2 additions & 0 deletions R/glimpse.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
#' @examples
#' glimpse(mtcars)
#'
#' \donttest{
#' if (require("RSQLite") && has_lahman("sqlite")) {
#' batting <- tbl(lahman_sqlite(), "Batting")
#' glimpse(batting)
#' }
#' }
glimpse <- function(tbl, width = getOption("width")) {
cat("Observations: ", big_mark(nrow(tbl)), "\n", sep = "")
if (ncol(tbl) == 0) return(invisible())
Expand Down
2 changes: 1 addition & 1 deletion man/compute.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ restrictions can be placed on.
it.
}
\examples{
\donttest{
if (require("RSQLite") && has_lahman("sqlite")) {
batting <- tbl(lahman_sqlite(), "Batting")
remote <- select(filter(batting, yearID > 2010 && stint == 1), playerID:H)
\donttest{
remote2 <- collapse(remote)
cached <- compute(remote)
local <- collect(remote)
Expand Down
2 changes: 2 additions & 0 deletions man/explain.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ how \code{EXPLAIN} works for your database, but is very useful for
diagnosing performance problems.
}
\examples{
\donttest{
if (require("RSQLite") && has_lahman("sqlite")) {

lahman_s <- lahman_sqlite()
Expand All @@ -46,4 +47,5 @@ teams <- tbl(lahman_s, "Teams")
batting \%>\% left_join(teams, c("yearID", "teamID")) \%>\% explain()
}
}
}

2 changes: 2 additions & 0 deletions man/glimpse.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ the underlying data, even when applied to a remote data source.)
\examples{
glimpse(mtcars)
\donttest{
if (require("RSQLite") && has_lahman("sqlite")) {
batting <- tbl(lahman_sqlite(), "Batting")
glimpse(batting)
}
}
}
2 changes: 2 additions & 0 deletions man/lahman.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ for that package for documentation of the inidividual tables.
}
\examples{
# Connect to a local sqlite database, if already created
\donttest{
if (has_lahman("sqlite")) {
lahman_sqlite()
batting <- tbl(lahman_sqlite(), "Batting")
Expand All @@ -61,5 +62,6 @@ if (has_lahman("postgres")) {
batting <- tbl(lahman_postgres(), "Batting")
}
}
}
\keyword{internal}

0 comments on commit f4bf9d2

Please sign in to comment.