add.ranks {UCS} | R Documentation |
Add rankings (with or without ties) for specified association measures to a data set object.
add.ranks(ds, keys=ds.find.am(ds), randomise=TRUE, overwrite=TRUE)
ds |
a UCS data set object |
keys |
a character vector giving the names of one or more association measures. When it is omitted, rankings are computed for all annotated measures. |
randomise |
if TRUE , ties are broken randomly (default).
Otherwise, tied rows are assigned the same rank, which is the first
free one (as in the Olympic Games). See below for prerequisites. |
overwrite |
if TRUE , existing rankings are overwritten
(default). Otherwise, association measures for which ranks are
already annotated are silently skipped. If you modify association
scores within R, be sure to call add.ranks with
overwrite=TRUE . |
Since add.ranks
is based on the order.by.am
function,
the prerequisites are the same: the data set must contain association
scores for the random
measure if randomise=TRUE
and an
id
variable if randomise=FALSE
. See the
order.by.am
manpage for further information.
Invisibly returns a copy of ds
annotated with the requested
rankings. The rankings are stored in variables r.*
, where
*
stands for the name of an association measure (according to
the UCS naming conventions, cf. the am.key2var
manpage).
order.by.am
, am.key2var
,
ds.find.am
, read.ds.gz
## from the UCS/R tutorial GLAW <- read.ds.gz("glaw.scores.ds.gz") GLAW <- add.ranks(GLAW) ## combine into single command GLAW <- add.ranks(read.ds.gz("glaw.scores.ds.gz"))