-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathadd_variables.Rd
More file actions
40 lines (38 loc) · 1.37 KB
/
add_variables.Rd
File metadata and controls
40 lines (38 loc) · 1.37 KB
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
36
37
38
39
40
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/build.R
\name{add_variables}
\alias{add_variables}
\title{Add Missing Variables}
\usage{
add_variables(dataset, metacore, dataset_name = deprecated())
}
\arguments{
\item{dataset}{Dataset to add columns to. If all variables are present no
columns will be added.}
\item{metacore}{metacore object that only contains the specifications for the
dataset of interest.}
\item{dataset_name}{Optional string to specify the dataset. This is only
needed if the metacore object provided hasn't already been subsetted.\cr
Note: Deprecated in version 0.2.0. The \code{dataset_name} argument will be removed
in a future release. Please use \code{metacore::select_dataset} to subset the
\code{metacore} object to obtain metadata for a single dataset.}
}
\value{
The given dataset with any additional columns added
}
\description{
This function adds in missing columns according to the type set in the
metacore object. All values in the new columns will be missing, but typed
correctly. If unable to recognize the type in the metacore object will return
a logical type.
}
\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(-TRTSDT, -TRT01P, -TRT01PN)
add_variables(data, spec)
}