Displaying 5 results from an estimated 5 matches for "isn0".
Did you mean:
isn
2020 Feb 21
0
function(x) !is.na(x) & x "is_true(.)" etc. was: [R] How to index..
...ot=matrix )
## Need to consider NAs ; "== 0" even works for logical & complex:
## Note that "!x" is faster than "x == 0", but does not (yet!) work for complex
## if we did these in C, would gain a factor 2 (or so):
is0 <- function(x) !is.na(x) & x == 0
isN0 <- function(x) is.na(x) | x != 0
is1 <- function(x) !is.na(x) & x # also == "isTRUE componentwise"
{{Note that here 0 <==> FALSE and non-0 <==> TRUE , and I
had preferred the shorter words to the longer ones in the
Matrix pkg, not the least as '0...
2015 Mar 03
2
[R] Why does R replace all row values with NAs
...:10,b=2:11,c=c(1,NA,3,NA,5,NA,7,NA,NA,10))
>> x[is.true(x$c >= 6), ]
> a b c
> 7 7 8 7
> 10 10 11 10
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
Yes; the Matrix package has had these
is0 <- function(x) !is.na(x) & x == 0
isN0 <- function(x) is.na(x) | x != 0
is1 <- function(x) !is.na(x) & x # also == "isTRUE componentwise"
namespace hidden for a while [note the comment of the last one!]
and using them for readibility in its own code.
Maybe we should (again) consider providing some versions of...
2015 Mar 03
2
[R] Why does R replace all row values with NAs
...t;> > 7 7 8 7
>> > 10 10 11 10
>>
>> > Bill Dunlap
>> > TIBCO Software
>> > wdunlap tibco.com
>>
>> Yes; the Matrix package has had these
>>
>> is0 <- function(x) !is.na(x) & x == 0
>> isN0 <- function(x) is.na(x) | x != 0
>> is1 <- function(x) !is.na(x) & x # also == "isTRUE componentwise"
>
> Note that using %in% to block propagation of NAs is about 2x faster:
>
> > x <- sample(c(NA_integer_, 1:10000), 500000, replace=TRUE)
> >...
2015 Mar 03
0
[R] Why does R replace all row values with NAs
...ue(x$c >= 6), ]
> > a b c
> > 7 7 8 7
> > 10 10 11 10
>
> > Bill Dunlap
> > TIBCO Software
> > wdunlap tibco.com
>
> Yes; the Matrix package has had these
>
> is0 <- function(x) !is.na(x) & x == 0
> isN0 <- function(x) is.na(x) | x != 0
> is1 <- function(x) !is.na(x) & x # also == "isTRUE componentwise"
Note that using %in% to block propagation of NAs is about 2x faster:
> x <- sample(c(NA_integer_, 1:10000), 500000, replace=TRUE)
> microbenchmark(as.logical(...
2015 Mar 03
0
[R] Why does R replace all row values with NAs
...; > 10 10 11 10
>>>
>>> > Bill Dunlap
>>> > TIBCO Software
>>> > wdunlap tibco.com
>>>
>>> Yes; the Matrix package has had these
>>>
>>> is0 <- function(x) !is.na(x) & x == 0
>>> isN0 <- function(x) is.na(x) | x != 0
>>> is1 <- function(x) !is.na(x) & x # also == "isTRUE componentwise"
>>>
>>
>> Note that using %in% to block propagation of NAs is about 2x faster:
>>
>> > x <- sample(c(NA_integer_, 1:10000),...