Displaying 3 results from an estimated 3 matches for "firstna".
Did you mean:
firstn
2023 Apr 25
1
xyTable(x,y) versus table(x,y) with NAs
...t;- signif(x$y, digits = digits)
??? x <- signif(x$x, digits = digits)
??? n <- length(x)
??? number <- if (n > 0) {
??????? orderxy <- order(x, y)
??????? x <- x[orderxy]
??????? y <- y[orderxy]
??????? first <- c(TRUE, (x[-1L] != x[-n]) | (y[-1L] != y[-n]))
??????? firstNA <- c(TRUE, xor(is.na(x[-1L]), is.na(x[-n])) |
xor(is.na(y[-1L]), is.na(y[-n])))
??????? first[firstNA] <- TRUE
??????? first[is.na(first) | isFALSE(first)] <- FALSE
??????? x <- x[first]
??????? y <- y[first]
??????? diff(c((1L:n)[first], n + 1L))
??? }
??? else integer()
??...
2023 Apr 25
1
xyTable(x,y) versus table(x,y) with NAs
...> ??? x <- signif(x$x, digits = digits)
> ??? n <- length(x)
> ??? number <- if (n > 0) {
> ??????? orderxy <- order(x, y)
> ??????? x <- x[orderxy]
> ??????? y <- y[orderxy]
> ??????? first <- c(TRUE, (x[-1L] != x[-n]) | (y[-1L] != y[-n]))
> ??????? firstNA <- c(TRUE, xor(is.na(x[-1L]), is.na(x[-n])) |
> xor(is.na(y[-1L]), is.na(y[-n])))
> ??????? first[firstNA] <- TRUE
> ??????? first[is.na(first) | isFALSE(first)] <- FALSE
> ??????? x <- x[first]
> ??????? y <- y[first]
> ??????? diff(c((1L:n)[first], n + 1L))
>...
2023 Apr 25
2
xyTable(x,y) versus table(x,y) with NAs
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 <- c(1, 1, 2, 2, 2, 3)
y <- c(1, 2, 1, 3, NA, 3)
table(x, y, useNA="always")
xyTable(x, y)