I have a long vector of date strings that I want to convert to POSIXct objects. When I call as.POSIXct I get this error:
Error: character string is not in a standard unambiguous format
How do I find which element of the vector caused the error? For example, what would tell me the error in the following code was caused by the second element:
as.POSIXct(c('2015-12-10', 'aaa', '2015-12-11'))
?
==============
Edit: I'm looking for an answer that's general to vectorized functions in R, as.POSIXct is just an example. In general, when f(x)
encounters an error, which element of x
caused it?