Hi Rich,
My suggestion was not 'to make a difference'. It was to determine
whether the NAs or NaNs appear before the dplyr commands. You
confirmed that they do. There are 2321 NAs in vel. Bert suggested some
ways that an NA might appear.
Best,
Eric
On Tue, Sep 14, 2021 at 6:42 PM Rich Shepard <rshepard at appl-ecosys.com>
wrote:>
> 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
>
> ______________________________________________
> 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/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.