Hi,
I have a project where a testing file I was working on was saved in excel. Now I run the same code for exactly the same data but taken directly from the database and the code is not working.
Error: `false` must be a double vector, not an integer vector
Very weird because when I export the source of data to Excel and import again (from excel), the code works fine without any error.
The database is to big to give you access to data or an example.
Does R environment work differently when the same data is taken from different resources?
The only change I made is that I changed if_else to ifelse, as it seemed to me that the last line is creating the problem because of strict type requirements of if_else.
If this does not work, can you please provide a REPRoducible EXample of your problem? It provides more specifics of your problem, and it helps others to understand what problem you are facing.
If you don't know how to do it, take a look at this thread:
I'm guessing that there are columns which are stored as integers in the database, and so R reads them as integers, whereas the Excel file had everything stored as decimals due to number formatting or similar.