Skip to content
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

Differentiate between multiple function(x) calls in across() #233

Closed
trangdata opened this issue Feb 17, 2022 · 2 comments
Closed

Differentiate between multiple function(x) calls in across() #233

trangdata opened this issue Feb 17, 2022 · 2 comments

Comments

@trangdata
Copy link

Maybe I'm missing something entirely, but when I specify function(x) in acr()'s function list (say, if I wanted to specify additional arguments to each function), it doesn't quite work...

library(collapse)
#> Warning: package 'collapse' was built under R version 4.1.2
#> collapse 1.7.6, see ?`collapse-package` or ?`collapse-documentation`
#> 
#> Attaching package: 'collapse'
#> The following object is masked from 'package:stats':
#> 
#>     D

mtcars |>
  fsummarise(
    acr(
      mpg, list(
        ssdd = sd,
        mu = mean
      )
    )
  )
#>   mpg_ssdd   mpg_mu
#> 1 6.026948 20.09062

mtcars |>
  fsummarise(
    acr(
      mpg, list(
        ssdd = function(x) sd(x),
        mu = function(x) mean(x)
      )
    )
  )
#>   mpg_ssdd   mpg_mu
#> 1 6.026948 6.026948

Created on 2022-02-17 by the reprex package (v2.0.1)

@SebKrantz
Copy link
Owner

Thanks, this is interesting, it seems to have to do with you using x in both cases. Using x for the first and yfor the second works. I'll keep this issue open until it is solved.

@SebKrantz SebKrantz changed the title Peculiar behavior when using function(x) ... in acr() Differentiate between multiple function(x) calls in across() Feb 17, 2022
@SebKrantz
Copy link
Owner

This has been fixed now. You can install the development version from GitHub. CRAN update will have to wait another month or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants