Hello,
Maybe
which(is.na(pdx_stage$ft))
Have you tried na.rm = TRUE?
mean(pdx_stage$ft, na.rm = TRUE)
Hope this helps,
Rui Barradas
?s 18:34 de 04/11/21, Rich Shepard escreveu:> 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
>
> ______________________________________________
> 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.