Re: [Rd] [R] Why does R replace all row values with NAs

2015-03-03 Thread Hervé Pagès
On 03/03/2015 02:17 PM, Gabriel Becker wrote: Stephanie, Actually, it's as.logical that isn't preserving matrix dimensions, because it coerces to a logical vector: > x <- matrix(sample(c(NA_integer_, 1:100), 500, replace=TRUE), nrow=50) > dim(as.logical(x)) It's true, as.logical() doesn't

Re: [Rd] [R] Why does R replace all row values with NAs

2015-03-03 Thread Gabriel Becker
Stephanie, Actually, it's as.logical that isn't preserving matrix dimensions, because it coerces to a logical vector: > x <- matrix(sample(c(NA_integer_, 1:100), 500, replace=TRUE), nrow=50) > dim(as.logical(x)) NULL ~G On Tue, Mar 3, 2015 at 2:09 PM, Stephanie M. Gogarten < sdmor...@u.washingt

Re: [Rd] [R] Why does R replace all row values with NAs

2015-03-03 Thread Stephanie M. Gogarten
On 3/3/15 1:26 PM, Hervé Pagès wrote: On 03/03/2015 02:28 AM, Martin Maechler wrote: Diverted from R-help : as it gets into musing about new R language "primitives" William Dunlap on Fri, 27 Feb 2015 08:04:36 -0800 writes: > You could define functions like > is.true

Re: [Rd] [R] Why does R replace all row values with NAs

2015-03-03 Thread Hervé Pagès
On 03/03/2015 02:28 AM, Martin Maechler wrote: Diverted from R-help : as it gets into musing about new R language "primitives" William Dunlap on Fri, 27 Feb 2015 08:04:36 -0800 writes: > You could define functions like > is.true <- function(x) !is.na(x) & x > is.f

Re: [Rd] [R] Why does R replace all row values with NAs

2015-03-03 Thread Martin Maechler
Diverted from R-help : as it gets into musing about new R language "primitives" > William Dunlap > on Fri, 27 Feb 2015 08:04:36 -0800 writes: > You could define functions like > is.true <- function(x) !is.na(x) & x > is.false <- function(x) !is.na(x) & !x > and