drop_unspec_vars {metatools} | R Documentation |
Drop Unspecified Variables
Description
This function drops all unspecified variables. It will throw and error if the dataset does not contain all expected variables.
Usage
drop_unspec_vars(dataset, metacore, dataset_name = NULL)
Arguments
dataset |
Dataset to change |
metacore |
metacore object that only contains the specifications for the dataset of interest. |
dataset_name |
Optional string to specify the dataset. This is only needed if the metacore object provided hasn't already been subsetted. |
Value
Dataset with only specified columns
Examples
library(metacore)
library(haven)
library(dplyr)
load(metacore_example("pilot_ADaM.rda"))
spec <- metacore %>% select_dataset("ADSL")
data <- read_xpt(metatools_example("adsl.xpt")) %>%
select(USUBJID, SITEID) %>%
mutate(foo = "Hello")
drop_unspec_vars(data, spec)
[Package metatools version 0.1.6 Index]