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

transform_sample_counts() fails on multi-argument functions #1262

Open
mikemc opened this issue Nov 8, 2019 · 0 comments · May be fixed by #1263
Open

transform_sample_counts() fails on multi-argument functions #1262

mikemc opened this issue Nov 8, 2019 · 0 comments · May be fixed by #1263

Comments

@mikemc
Copy link
Contributor

mikemc commented Nov 8, 2019

library(phyloseq)
data(GlobalPatterns)

f <- function(x, y) {x + y}
ps <- transform_sample_counts(GlobalPatterns, f, y = 2)
#> Error in fun(1:10): argument "y" is missing, with no default

Created on 2019-11-08 by the reprex package (v0.3.0)

The problem is due to a missing ... at

if( !identical(length(fun(1:10)), 10L) ){stop("`fun` not valid function.")}

Changing this line to

	if( !identical(length(fun(1:10, ...)), 10L) ){stop("`fun` not valid function.")}

fixes the issue.

mikemc added a commit to mikemc/phyloseq that referenced this issue Nov 8, 2019
@mikemc mikemc linked a pull request Nov 8, 2019 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant