id L Carlson
> Department of Anthropology
> Texas A&M University
> College Station, TX 77843-4352
>
> -Original Message-
> From: R-help On Behalf Of Ed Siefker
> Sent: Wednesday, February 27, 2019 5:03 PM
> To: r-help
> Subject: [R] inverse of which()
>
The inverse of which() would have to know the length of the logical vector
to create. The function could be
invWhich <- function(whichTrue, length) {
stopifnot(length <= max(whichTrue), !anyNA(whichTrue))
v <- logical(length)
v[whichTrue] <- TRUE
v
}
It isn't quit
use grepl?
On February 27, 2019 3:03:27 PM PST, Ed Siefker wrote:
>Given a vector of booleans, chich() will return indices that are TRUE.
>
>Given a vector of indices, how can I get a vector of booleans?
>
>My intent is to do logical operations on the output of grep(). Maybe
>there's a better wa
-help On Behalf Of Ed Siefker
Sent: Wednesday, February 27, 2019 5:03 PM
To: r-help
Subject: [R] inverse of which()
Given a vector of booleans, chich() will return indices that are TRUE.
Given a vector of indices, how can I get a vector of booleans?
My intent is to do logical operations on the
Given a vector of booleans, chich() will return indices that are TRUE.
Given a vector of indices, how can I get a vector of booleans?
My intent is to do logical operations on the output of grep(). Maybe
there's a better way to do this?
Thanks
-Ed
__
5 matches
Mail list logo