I have the following vector that assigns col_types to a data frame:
mytypes = c("text","text","text","text","text","text","text","text","text","text","text","numeric","text","text","text","text","numeric")
The next line creates a data frame:
df <- data.frame(read_excel(path = path_vector[1], col_names = TRUE,
skip = 13,col_types=mytypes), stringsAsFactors = FALSE)
Whenever I run this second line, I get the following error:
"1: In read_fun(path = enc2native(normalizePath(path)), sheet_i = sheet, ... :
Expecting numeric in L15 / R15C12: got a date"
Columns 12 and 17 are currency, so there will be positive and negative values. Since there can't be negative dates, these negative values are lost. In looking at the excel workbook that is being read, those two columns are set to custom numbers:
Screen grab from excel workbook:
I'm guessing this is where the error is coming from. Any ideas how to work around this? There are a few thousand files that have to be read, so it's not really feasible to go in and manually change the column types. Thanks!
Edit: so I am dumb, the fix was really simple. I just changed all of the mytypes entries to "text." Took care of everything. Thanks for the response!