sign2 | R Documentation |
..
sign2(
e1,
e2,
name1 = substitute(e1),
name2 = substitute(e2),
na.detail = TRUE,
...
)
e1 , e2 |
two R objects, must be both numeric vectors, or ordered factors with the same levels |
name1 , name2 |
two language objects, or character scalars |
na.detail |
logical scalar,
whether to provide the missingness details of |
... |
additional parameters, currently not in use |
Function sign2 extends sign in the following ways
two ordered factors can be compared;
(detailed) information on missingness are provided.
Function sign2 returns character vector when na.detail = TRUE
, or
ordered factor when na.detail = FALSE
.
lv = letters[c(1,3,2)]
x0 = letters[1:3]
x = ordered(sample(x0, size = 100, replace = TRUE), levels = lv)
y = ordered(sample(x0, size = 50, replace = TRUE), levels = lv)
x < y # base R ok
pmax(x, y) # base R okay
pmin(x, y) # base R okay
x[c(1,3)] = NA
y[c(3,5)] = NA
table(sign(unclass(y) - unclass(x)))
table(sign2(x, y))
table(sign2(x, y, na.detail = FALSE), useNA = 'always')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.