prep_query {vivainsights} | R Documentation |
Prepare variable names and types in query data frame for analysis
Description
For applying to data frames that are read into R using any
other method other than import_query()
, this function cleans variable
names by replacing special characters and converting the relevant variable
types so that they are compatible with the rest of the functions in
vivainsights.
Usage
prep_query(data, convert_date = TRUE, date_format = "%m/%d/%Y")
Arguments
data |
A Standard Person Query dataset in the form of a data frame. You
should pass the data frame that is read into R using any other method
other than |
convert_date |
Logical. Defaults to |
date_format |
String specifying the date format for converting any
variable that may be a date to a Date variable. Defaults to |
Value
A tibble
with the cleaned data frame is returned.
Examples
The following shows when and how to use prep_query()
:
pq_df <- read.csv("path_to_query.csv") cleaned_df <- pq_df |> prep_query()
You can then run checks to see that the variables are of the correct type:
dplyr::glimpse(cleaned_df)
See Also
Other Import and Export:
copy_df()
,
create_dt()
,
export()
,
import_query()