casewhen | R Documentation |
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.)
casewhen(inputfile = NULL, header = FALSE)
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. |
A string that represents the constructed CASE statement
input <- Data_Frame <- data.frame(Training = c("Strength", "Stamina",
"Other"), Duration = c(60, 30, 45))
result <- casewhen(inputfile = input, header = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.