Description Usage Arguments Details Value Examples
A safe version of ifelse that preserves class
1 | safe_ifelse(test, yes, no)
|
test |
An object which can be coerced to logical mode. |
yes |
return values for true elements of test. |
no |
return values for false elements of test. |
A safe version of ifelse that preserves class. Taken from http://stackoverflow.com/questions/6668963/how-to-prevent-ifelse-from-turning-date-objects-into-numeric-objects
Same as ifelse but preserving the class (works with dates).
1 2 | dates <- as.Date(c('2011-01-01', '2011-01-02', '2011-01-03', '2011-01-04', '2011-01-05'))
safe_ifelse(dates == '2011-01-01', dates - 1, dates)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.