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.
prep_query(data, convert_date = TRUE, date_format = "%m/%d/%Y")A tibble with the cleaned data frame is returned.
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(), as import_query() automatically performs the
same variable operations.
Logical. Defaults to TRUE. When set to TRUE, any
variable that matches true with is_date_format() gets converted to a Date
variable. When set to FALSE, this step is skipped.
String specifying the date format for converting any
variable that may be a date to a Date variable. Defaults to "%m/%d/%Y".
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)
Other Import and Export:
copy_df(),
create_dt(),
export(),
import_query()