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

Warning when factorial arguments conflict #251

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

clarabicalho
Copy link
Contributor

Return warning for which value takes precedence when user inputs both sd and outcome_sds and they do not match.

Warning for which value takes precedence when user inputs both `sd` and `outcome_sds` and they do not match.
@@ -78,6 +78,8 @@ two_by_two_designer <- function(N = 100,
if(max(c(sd_i, outcome_sds) < 0) ) stop("sd_i and outcome_sds must be nonnegative")
if(max(c(prob_A, prob_B) < 0)) stop("prob_ arguments must be nonnegative")
if(max(c(prob_A, prob_B) > 1)) stop("prob_ arguments must not exceed 1")
if(!is.null(outcome_means) && all(!is.null(c(mean_A0B0, mean_A0B1, mean_A1B0, mean_A1B1))) &&
Copy link
Contributor

@nfultz nfultz Aug 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this check will work as intended, it is not user friendly to require people to set outcome_means=NULL when they want to provide all 4 means.

Also is.null is not vectorized, would double check the second half as well.

> is.null(c(2, NULL))
[1] FALSE

Adding some tests that set the mean_AB params should help shake out these issues.

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 this pull request may close these issues.

2 participants