I had a dataframe with monthly stock data.
25 columns of which 24 are 'chr', and the Date was a 'yearmon num'.
Running the following code gave no problems:
tmp = tmp %>% mutate_at(vars(names(tmp)[4:ncol(tmp)]), funs(as.numeric)) %>%
mutate_if(is.numeric, funs(ifelse(is.infinite(.), NA, .))) %>% # replace Inf w/ NA's
mutate_if(is.numeric, funs(round(., 5))) %>% # round to 5 decimal places (for some reason, 0's not properly coded in some instances)
select(-c(COGS, SGAE, RD, NIBED, INVT, PPEG, LTD, DPS, EPS, CFPS)) %>%
filter(is.na(ISIN) == F & year(Date) < 2019) %>%
distinct()
Now I have donwloaded the weekly data, and the catagory of this column is either 'Date' or 'numeric'.
When I run the exact same code, I am getting the following error:
"Error in as.POSIXlt.numeric(x, tz = tz(x)) : 'origin' must be supplied"
Is there any 'yearweek num' I can select, or is there any other solution for this?
Thanks!