Re: [Rd] xyTable(x,y) versus table(x,y) with NAs

2023-04-25 Thread Serguei Sokol via R-devel
Le 25/04/2023 à 17:39, Bill Dunlap a écrit : x <- c(1, 1, 2, 2, 2, 3) y <- c(1, 2, 1, 3, NA, 3) str(xyTable(x,y)) List of 3 $ x : num [1:6] 1 1 2 2 NA 3 $ y : num [1:6] 1 2 1 3 NA 3 $ number: int [1:6] 1 1 1 NA NA 1 How many (2,3)s do we have? At least one, the third entry, bu

Re: [Rd] xyTable(x,y) versus table(x,y) with NAs

2023-04-25 Thread Bill Dunlap
x <- c(1, 1, 2, 2, 2, 3) y <- c(1, 2, 1, 3, NA, 3) > str(xyTable(x,y)) List of 3 $ x : num [1:6] 1 1 2 2 NA 3 $ y : num [1:6] 1 2 1 3 NA 3 $ number: int [1:6] 1 1 1 NA NA 1 How many (2,3)s do we have? At least one, the third entry, but the fourth entry, (2,NA), is possibly a (2,3) so

Re: [Rd] xyTable(x,y) versus table(x,y) with NAs

2023-04-25 Thread Viechtbauer, Wolfgang (NP)
Sokol [mailto:so...@insa-toulouse.fr] >Sent: Tuesday, 25 April, 2023 11:35 >To: Viechtbauer, Wolfgang (NP); r-devel@r-project.org >Subject: Re: [Rd] xyTable(x,y) versus table(x,y) with NAs > >I correct myself. Obviously, the line > >first[is.na(first) | isFALSE(first)] <- FALSE

Re: [Rd] xyTable(x,y) versus table(x,y) with NAs

2023-04-25 Thread Serguei Sokol via R-devel
I correct myself. Obviously, the line first[is.na(first) | isFALSE(first)] <- FALSE should read first[is.na(first)] <- FALSE Serguei. Le 25/04/2023 à 11:30, Serguei Sokol a écrit : Le 25/04/2023 à 10:24, Viechtbauer, Wolfgang (NP) a écrit : Hi all, Posted this many years ago (https://stat

Re: [Rd] xyTable(x,y) versus table(x,y) with NAs

2023-04-25 Thread Serguei Sokol via R-devel
Le 25/04/2023 à 10:24, Viechtbauer, Wolfgang (NP) a écrit : Hi all, Posted this many years ago (https://stat.ethz.ch/pipermail/r-devel/2017-December/075224.html), but either this slipped under the radar or my feeble mind is unable to understand what xyTable() is doing here and nobody bothered

[Rd] xyTable(x,y) versus table(x,y) with NAs

2023-04-25 Thread Viechtbauer, Wolfgang (NP)
Hi all, Posted this many years ago (https://stat.ethz.ch/pipermail/r-devel/2017-December/075224.html), but either this slipped under the radar or my feeble mind is unable to understand what xyTable() is doing here and nobody bothered to correct me. I now stumbled again across this issue. x <-

[Rd] xyTable(x,y) versus table(x,y) with NAs

2017-12-14 Thread Viechtbauer Wolfgang (SP)
Hi All, I asked this over at r-help, but didn't get any responses. As this seems like a bug (or at least undocumented behavior) to me, I'll try again here. It seems to me that xyTable() gets thrown off by NAs: x <- c(1, 1, 2, 2, 2, 3) y <- c(1, 2, 1, 3, NA, 3) table(x, y, useNA="always") xyTab