File: dbplyr_uncount.Rd

package info (click to toggle)
r-cran-dbplyr 2.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,376 kB
  • sloc: sh: 13; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 1,015 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/verb-uncount.R
\name{dbplyr_uncount}
\alias{dbplyr_uncount}
\title{"Uncount" a database table}
\usage{
dbplyr_uncount(data, weights, .remove = TRUE, .id = NULL)
}
\arguments{
\item{data}{A lazy data frame backed by a database query.}

\item{weights}{A vector of weights. Evaluated in the context of \code{data};
supports quasiquotation.}

\item{.remove}{If \code{TRUE}, and \code{weights} is the name of a column in \code{data},
then this column is removed.}

\item{.id}{Supply a string to create a new variable which gives a unique
identifier for each created row.}
}
\description{
This is a method for the tidyr \code{uncount()} generic. It uses a temporary
table, so your database user needs permissions to create one.
}
\examples{
df <- memdb_frame(x = c("a", "b"), n = c(1, 2))
dbplyr_uncount(df, n)
dbplyr_uncount(df, n, .id = "id")

# You can also use constants
dbplyr_uncount(df, 2)

# Or expressions
dbplyr_uncount(df, 2 / n)
}