[R] mean() produces NA on double column

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Thu Nov 4 19:34:01 CET 2021


I'm not seeing what's different about this tibble so that mean() returns NA
on a column of doubles:
> head(pdx_stage)
# A tibble: 6 × 8
   site_nbr  year   mon   day    hr   min tz       ft
   <chr>    <int> <int> <int> <dbl> <dbl> <chr> <dbl>
1 14211720  2007    10     1     1     0 PDT    3.21
2 14211720  2007    10     1     1    30 PDT    3.12
3 14211720  2007    10     1     2     0 PDT    2.89
4 14211720  2007    10     1     2    30 PDT    2.65
5 14211720  2007    10     1     3     0 PDT    2.38
6 14211720  2007    10     1     3    30 PDT    2.14
> mean(pdx_stage$ft)
[1] NA

Other tibbles have doubles in the value column which mean() finds. For
example:
> head(pdx_depth_sens)
# A tibble: 6 × 8
   site_nbr  year   mon   day    hr   min tz       ft
   <chr>    <int> <int> <int> <dbl> <dbl> <chr> <dbl>
1 14211720  2009     1    22     0     0 PST    5.68
2 14211720  2009     1    22     0    30 PST    5.66
3 14211720  2009     1    22     1     0 PST    5.69
4 14211720  2009     1    22     1    30 PST    5.75
5 14211720  2009     1    22     2     0 PST    5.85
6 14211720  2009     1    22     2    30 PST    5.98
> mean(pdx_depth_sens$ft)
[1] 8.196686

How do I isolate the source of this issue?

Rich



More information about the R-help mailing list