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

equal function could be cleaner #37

Open
taylorokonek opened this issue Aug 2, 2021 · 0 comments
Open

equal function could be cleaner #37

taylorokonek opened this issue Aug 2, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@taylorokonek
Copy link
Collaborator

In termTraverse.R (soon to be in regress_utils.R), there is a function defined called equal, and the value returned calls the function itself (not sure if there are any implications to this?). The function seems to be doing the same thing as checking if length(unique(x)) == 1, other than that they would handle vectors that include NAs differently. This is mostly a reminder to myself to edit this helper function to be a bit cleaner in the future.

equal <- function(x){
if(length(x)==1){
return(TRUE)
} else {
if(x[1]!=x[2]){
return(FALSE)
} else {
return(equal(x[-1]))
}
}
}

@taylorokonek taylorokonek added the enhancement New feature or request label Aug 2, 2021
@taylorokonek taylorokonek self-assigned this Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant