https://github.com/hadley/dplyr
Tip revision: 4a944a80d5c3564a669bfe0c0a4af9fed86e92dd authored by Kirill Müller on 16 March 2018, 21:36:28 UTC
Merge branch 'r-0.7.4.9002' into production
Merge branch 'r-0.7.4.9002' into production
Tip revision: 4a944a8
compute.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/compute-collect.r
\name{compute}
\alias{compute}
\alias{collect}
\alias{collapse}
\title{Force computation of a database query}
\usage{
compute(x, name = random_table_name(), ...)
collect(x, ...)
collapse(x, ...)
}
\arguments{
\item{x}{A tbl}
\item{name}{Name of temporary table on database.}
\item{...}{Other arguments passed on to methods}
}
\description{
\code{compute()} stores results in a remote temporary table.
\code{collect()} retrieves data into a local tibble.
\code{collapse()} is slightly different: it doesn't force computation, but
instead forces generation of the SQL query. This is sometimes needed to work
around bugs in dplyr's SQL generation.
}
\details{
All functions preserve grouping and ordering.
}
\examples{
if (require(dbplyr)) {
mtcars2 <- src_memdb() \%>\%
copy_to(mtcars, name = "mtcars2-cc", overwrite = TRUE)
remote <- mtcars2 \%>\%
filter(cyl == 8) \%>\%
select(mpg:drat)
# Compute query and save in remote table
compute(remote)
# Compute query bring back to this session
collect(remote)
# Creates a fresh query based on the generated SQL
collapse(remote)
}
}
\seealso{
\code{\link[=copy_to]{copy_to()}}, the opposite of \code{collect()}: it takes a local data
frame and uploads it to the remote source.
}