-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
va() with grouped data #14
Comments
is actually not failing, but just gives warning, as per design from dplyr::mutate : library(tidyverse)
library(eye)
set.seed(42)
mydf <- cbind(group = rep(letters[1:3], 4),
setNames(as.data.frame(replicate(c(rnorm(11), NA), n = 3)), letters[24:26]))
mydf %>% mutate(va = va(x))
#> Warning: Problem with `mutate()` input `va`.
#> ℹ x (from logmar): NA introduced - implausible values
#> ℹ Input `va` is `va(x)`.
#> Warning: x (from logmar): NA introduced - implausible values
#> group x y z va
#> 1 a 1.37095845 2.2866454 -0.1719174 1.37095845
#> 2 b -0.56469817 -1.3888607 1.2146747 NA
#> 3 c 0.36312841 -0.2787888 1.8951935 0.36312841
#> 4 a 0.63286260 -0.1333213 -0.4304691 0.63286260
#> 5 b 0.40426832 0.6359504 -0.2572694 0.40426832
#> 6 c -0.10612452 -0.2842529 -1.7631631 -0.10612452
#> 7 a 1.51152200 -2.6564554 0.4600974 1.51152200
#> 8 b -0.09465904 -2.4404669 -0.6399949 -0.09465904
#> 9 c 2.01842371 1.3201133 0.4554501 2.01842371
#> 10 a -0.06271410 -0.3066386 0.7048373 -0.06271410
#> 11 b 1.30486965 -1.7813084 1.0351035 1.30486965
#> 12 c NA NA NA NA
mydf %>% group_by(group) %>% mutate(va = va(x))
#> x: from logmar
#> Warning: Problem with `mutate()` input `va`.
#> ℹ x (from logmar): NA introduced - implausible values
#> ℹ Input `va` is `va(x)`.
#> ℹ The error occurred in group 2: group = "b".
#> Warning: x (from logmar): NA introduced - implausible values
#> x: from logmar
#> # A tibble: 12 x 5
#> # Groups: group [3]
#> group x y z va
#> <chr> <dbl> <dbl> <dbl> <logmar>
#> 1 a 1.37 2.29 -0.172 1.37095845
#> 2 b -0.565 -1.39 1.21 NA
#> 3 c 0.363 -0.279 1.90 0.36312841
#> 4 a 0.633 -0.133 -0.430 0.63286260
#> 5 b 0.404 0.636 -0.257 0.40426832
#> 6 c -0.106 -0.284 -1.76 -0.10612452
#> 7 a 1.51 -2.66 0.460 1.51152200
#> 8 b -0.0947 -2.44 -0.640 -0.09465904
#> 9 c 2.02 1.32 0.455 2.01842371
#> 10 a -0.0627 -0.307 0.705 -0.06271410
#> 11 b 1.30 -1.78 1.04 1.30486965
#> 12 c NA NA NA NA Created on 2020-12-06 by the reprex package (v0.3.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can fail and give many warnings - maybe simply create warning if used on grouped data, with suggestion to ungroup.
The text was updated successfully, but these errors were encountered: