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

var.equal in t_test() can only be used with explicit TRUE/FALSE #44

Open
juliuspfadt opened this issue Oct 22, 2024 · 4 comments
Open

Comments

@juliuspfadt
Copy link

I came upon this trying to implement things for @jomulder in JASP. It seems the way some arguments are passed in t_test() (

var_eq <- cl[["var.equal"]]
) does not allow any statements that need "evaluation". My example:

dt <- read.csv("https://raw.githubusercontent.com/jasp-stats/jasp-desktop/development/Resources/Data%20Sets/debug.csv")
options <- list(variances = "equal")
bain::t_test(dt$contNormal, dt$contBinom, var.equal = options[["variances"]] == "equal")

varEqual <- options[["variances"]] == "equal"
bain::t_test(dt$contNormal, dt$contBinom, var.equal = varEqual)

neither of the two ways to pass a boolean to the function works. I think it should.

@cjvanlissa
Copy link
Owner

Thank you for bringing this to my attention Julius! I agree, but do you have a handle on how to fix it?

@juliuspfadt
Copy link
Author

when I put var_eq <- eval(cl[["var.equal"]]) for the line I linked, it works for me.

@cjvanlissa
Copy link
Owner

Hmm. I wonder if that would cause problems under other conditions. An explicit eval() call evaluates just that one argument in the parent environment.

@juliuspfadt
Copy link
Author

I can't think of any conditions, but I also only used this in this very specific instance. but how about evaluating all calls like var_eq <- eval.parent(cl[["var.equal"]])

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