View source: R/import_export.R
| assume_var_classes | R Documentation |
Classes/data types of data variables are assumed with this function and
exported to a .csv file for amendment. Any incorrect classes can then be
corrected and imported using import_var_classes.
Character and factor variables with exactly two unique non-missing values are
labelled "binary". Character variables with more than two but no more than
factor_threshold unique non-missing values are labelled "factor".
assume_var_classes(data, out_file = NULL, factor_threshold = 5L)
data |
data frame |
out_file |
file where variables and their assumed classes are stored for user verification. |
factor_threshold |
integer. Maximum number of unique non-missing values
for a character variable to be labelled "factor". Variables with exactly 2
unique values are labelled "binary" regardless of this threshold. Set to
|
Writes a .csv file containing the variables and their assumed data types / classes.
import_var_classes
# example below assumes incorrectly for several variables
tmp = tempfile(fileext = ".csv")
data(example_data)
assume_var_classes(example_data, tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.