[R] Need fresh eyes to see what I'm missing

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Tue Sep 14 17:41:15 CEST 2021


On Tue, 14 Sep 2021, Eric Berger wrote:

> Before you create vel_by_month you can check vel for NAs and NaNs by
>
> sum(is.na(vel))
> sum(unlist(lapply(vel,is.nan)))

Eric,

There should not be any missing values in the data file. Regardless, I added
those lines to the script and it made no difference.

Running those commands on the R command line showed these results:
> sum(is.na(vel))
[1] 2321
> sum(unlist(lapply(vel,is.nan)))
[1] 0

Yet the monthly summaries retain the initial line:
> vel_by_month
# A tibble: 67 × 3
# Groups:   year [8]
     year month   flow
    <int> <int>  <dbl>
  1     0    NA NaN

I've another data set with the same issue (that's 2 out of 5) and I assume
the source of the problem is the same with both.

The data sets have no NAs or missing values at the end of a line.

Thanks for the ideas,

Rich



More information about the R-help mailing list