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

Truth value of vectors should be explained #10

Open
tdsmith opened this issue Oct 29, 2013 · 0 comments
Open

Truth value of vectors should be explained #10

tdsmith opened this issue Oct 29, 2013 · 0 comments

Comments

@tdsmith
Copy link
Owner

tdsmith commented Oct 29, 2013

issue raised in #8:

Furthermore, you forget dealing with vectors in the check:

> if (1:3) print('yes') else print('no')
[1] "yes"
Warning message:
In if (1:3) print("yes") else print("no") :
  the condition has length > 1 and only the first element will be used
> if (identical(TRUE, as.logical(1:3))) print('yes') else print('no')
[1] "no"

So invoking as.logical is not going to help you to test for the truth value of an "arbitrary not-necessarily-already-boolean value", only if it's already a scalar.

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

1 participant