casewhen {sqlcaser} | R Documentation |
Generate a SQL CASE statement from a mapping file
Description
This function constructs a CASE..WHEN,,THEN statement from a mapping file or dataframe. It assumes that the first column of the mapping data contains the original WHEN values, and the second column contains the THEN values (the values to be mapped to.)
Usage
casewhen(inputfile = NULL, header = FALSE)
Arguments
inputfile |
Mapping dataframe OR path to the mapping file |
header |
If reading a csv file, TRUE if the file includes a header row, FALSE if it does not include a header row. |
Value
A string that represents the constructed CASE statement
Examples
input <- Data_Frame <- data.frame(Training = c("Strength", "Stamina",
"Other"), Duration = c(60, 30, 45))
result <- casewhen(inputfile = input, header = TRUE)
[Package sqlcaser version 0.2.0 Index]