Displaying 3 results from an estimated 3 matches for "xytablena".
Did you mean:
xytable
2023 Apr 25
1
xyTable(x,y) versus table(x,y) with NAs
...diff(), a number of repeated pairs is obtained. However, as 'first' will
contain one NA? for your example, the diff() call will produce two NAs
by taking the difference with precedent and following number. Hence, the
result.
Here is a slightly modified code ox xyTable to handle NA too.
xyTableNA <- function (x, y = NULL, digits)
{
??? x <- xy.coords(x, y, setLab = FALSE)
??? y <- 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...
2023 Apr 25
1
xyTable(x,y) versus table(x,y) with NAs
...s is obtained. However, as
> 'first' will contain one NA? for your example, the diff() call will
> produce two NAs by taking the difference with precedent and following
> number. Hence, the result.
>
> Here is a slightly modified code ox xyTable to handle NA too.
>
> xyTableNA <- function (x, y = NULL, digits)
> {
> ??? x <- xy.coords(x, y, setLab = FALSE)
> ??? y <- signif(x$y, digits = digits)
> ??? x <- signif(x$x, digits = digits)
> ??? n <- length(x)
> ??? number <- if (n > 0) {
> ??????? orderxy <- order(x, y)
> ?????...
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)