get a single Boolean value from set in R -
u= runif(5) head=u[u<0.5] u[1:5] == head
if run third row in code, false false false true. (it might different in other seed of computer.) want single boolean value indicates whether value of u head or not. in other word, if element of u head, expected value true. if element of u not head, want false printed.
i think want:
u= runif(5) all(u<.5) #[1] false
in version length of head
less 5 assigning u[1:5] lead confusion or error.
Comments
Post a Comment