Hi, manipulating a dataframe imported by haven::read_sas, the call of dplyr::il_else led to the confusing following error message : error false must be a Date object, not a Date object
Both columns I used in the true/false arguments of if_else were of the class Date :
Maybe the blame is on haven::read_sas which should not create Date format with integer type, anyway it will be great if the dplyr::if_else error message said rather in this case : "error false must be of integer format, not a double format. It would have save me some time.
Could you please turn this into a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.
There's also a nice FAQ on how to do a minimal reprex for beginners, below:
What to do if you run into clipboard problems
If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.
library(dplyr)
int_date <- Sys.Date()
num_date <- Sys.Date()
storage.mode(int_date) <- "integer"
if_else(TRUE, int_date, num_date)
# Error: `false` must be a `Date` object, not a `Date` object
# Call `rlang::last_error()` to see a backtrace
If you need to know how to report bugs for any package, you can run this command:
# dplyr is the example, but any package name will do
packageDescription("dplyr", fields = c("BugReports", "Maintainer"))
# BugReports: https://github.com/tidyverse/dplyr/issues
# Maintainer: Hadley Wickham <hadley@rstudio.com>
#
# -- File: C:/Users/nwerth/Documents/R/win-library/3.6/dplyr/Meta/package.rds
# -- Fields read: BugReports, Maintainer
If there's a BugReports field, it tells you where to go. Otherwise, send an email to the person named in Maintainer.