ys_prune | R Documentation |
Use this to scavenge a data frame for columns that you want to keep. Select
additional columns through ...
. Do not use this for final column selection;
use dplyr::select()
instead.
ys_prune(data, spec, ..., .report = FALSE)
data |
A data frame with at least one column that is found in |
spec |
A |
... |
Additional columns carry into the output, specified using tidy-select syntax. |
.report |
If |
An error is generated if there are no columns in common between data
and
spec
.
A data frame with common columns with spec
and ...
, in the order they
appear in spec
.
data <- ys_help$data()
spec <- ys_help$spec()
data$STUDY <- NULL
head(ys_prune(data, spec))
head(ys_prune(data, spec, .report = TRUE))
data$FOO <- 1
data$BAR <- 2
data$YAK <- 3
head(ys_prune(data, spec, YAK, FOO))
# Use this for final subsetting
# It will fail if all the columns aren't there
data <- ys_help$data()
head(dplyr::select(data, names(spec)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.