The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Tired of littering your code with na.rm = TRUE?
tidyna masks common R functions and warns you when NAs
are removed. It handles some special cases. The table()
default is set to useNA = "ifany".
# CRAN version
install.packages("tidyna")
# or
# install.packages("pak")
pak::pak("statzhero/tidyna")library(tidyna)
x <- c(1, 2, NA)
mean(x)
#> ⚠️ 1 missing value removed.
#> [1] 1.5Suppress warnings with options(tidyna.warn = FALSE).
mean, sum,
prod, sd, var,
median, quantilemin, maxany, allrowSums,
rowMeanscortableAll-NA input throws error: When all values are NA,
tidyna throws an error instead of returning misleading values like
Inf, NaN, or 0:
sum(c(NA, NA))
#> Error: All values are NA; check if something went wrong.
base::sum(c(NA, NA), na.rm = TRUE)
#> [1] 0rowSums returns NA for
all-NA rows, but errors if the entire matrix is NA.
cor defaults to
use = "pairwise.complete.obs" instead of erroring on
NAs.
table defaults to
useNA = "ifany", showing NA counts when present rather than
silently dropping them.
v0.2.0 will add explicit _aware
suffixed versions (mean_aware, sum_aware,
etc.) for users who prefer not to mask base functions.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.