[R] Locating data source error in large file

Eric Berger
Fri, 20 Jul 2018 19:18:48 -0000

Hi Rich,
This may not be the most efficient but it will identify the offenders.

>  foo <-  paste(wy2016$date, wy2016$time))
> uu <- sapply(1:length(foo),
             function(i) { a <- try(as.POSIXct(foo[i]),silent=TRUE)
             "POSIXct" %in% class(a) })
> which(!uu)

HTH,
Eric



On Fri, Jul 20, 2018 at 9:58 PM, Rich Shepard <rshepard at
appl-ecosys.com>
wrote:

> On Fri, 20 Jul 2018, William Dunlap wrote:
>
> The problem occurs because no commonly used format works on all your date
>> strings. If you give as.POSIXlt the format you want to use then items
that
>> don't match the format will be treated as NA's. Use is.na() to
find them.
>>
>
> Bill,
>
>   No NAs found using both is.na() and scrolling through the source file.
> That's why I asked for help: I saw nothing different in the dates or
times.
>
> Regards,
>
> Rich
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]