Import a Viva Insights Query from a .csv file, with variable classifications optimised for other functions in the package.
import_query(
x,
pid = NULL,
dateid = NULL,
date_format = "%m/%d/%Y",
convert_date = TRUE,
encoding = "UTF-8"
)A tibble is returned.
String containing the path to the Viva Insights query to be
imported. The input file must be a .csv file, and the file extension must
be explicitly entered, e.g. "/files/standard query.csv"
String specifying the unique person or individual identifier
variable. import_query renames this to PersonId so that this is
compatible with other functions in the package. Defaults to NULL, where
no action is taken.
String specifying the date variable. import_query renames
this to MetricDate so that this is compatible with other functions in the
package. Defaults to NULL, where no action is taken.
String specifying the date format for converting any
variable that may be a date to a Date variable. Defaults to "%m/%d/%Y".
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 to specify encoding to be used within
data.table::fread(). See data.table::fread() documentation for more
information. Defaults to 'UTF-8'.
import_query() uses data.table::fread() to import .csv files for
speed, and by default stringsAsFactors is set to FALSE. A data frame is
returned by the function (not a data.table). Column names are automatically
cleaned, replacing spaces and special characters with underscores.
Other Import and Export:
copy_df(),
create_dt(),
export(),
prep_query()