weecology / portalr

A collection of functions to summarize the Portal Data
https://weecology.github.io/portalr/
Other
11 stars 12 forks source link

drop_na = FALSE not working when shape = "flat"? #294

Open ethanwhite opened 1 year ago

ethanwhite commented 1 year ago
rodents_crosstab = as_tibble(summarize_rodent_data(
  clean = TRUE,
  type = "Rodents",
  shape = "crosstab",
  time = "newmoon",
  output = "abundance",
  na_drop = FALSE,
  zero_drop = FALSE
))

rodents_flat = as_tibble(summarize_rodent_data(
  clean = TRUE,
  type = "Rodents",
  shape = "flat",
  time = "newmoon",
  output = "abundance",
  na_drop = FALSE,
  zero_drop = FALSE
))

rodents_crosstab |>
  select(newmoonnumber, PP) |>
  filter(newmoonnumber > 403) |>
  print(n = 20)
# A tibble: 163 × 2
   newmoonnumber    PP
           <int> <int>
 1           404     2
 2           405     7
 3           406    22
 4           407    22
 5           408    NA
 6           409    39
 7           410    NA
 8           411   104
 9           412    NA
10           413    36
# ℹ 153 more rows
# ℹ Use `print(n = ...)` to see more rows
rodents_flat |>
  filter(species == "PP") |>
  filter(newmoonnumber > 403) |>
  select(newmoonnumber, abundance) |>
  print(n = 20)
# A tibble: 122 × 2
   newmoonnumber abundance
           <int>     <int>
 1           404         2
 2           405         7
 3           406        22
 4           407        22
 5           409        39
 6           411       104
 7           413        36
 8           415         2
 9           416         0
10           417        12
# ℹ 112 more rows
# ℹ Use `print(n = ...)` to see more rows
ethanwhite commented 2 months ago

Fix portalr NA bug