
Prepare variable names and types in query data frame for analysis
Source:R/prep_query.R
      prep_query.RdFor 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.
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
import_query(), asimport_query()automatically performs the same variable operations.- convert_date
 Logical. Defaults to
TRUE. When set toTRUE, any variable that matches true withis_date_format()gets converted to a Date variable. When set toFALSE, this step is skipped.- date_format
 String specifying the date format for converting any variable that may be a date to a Date variable. Defaults to
"%m/%d/%Y".
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()