Description Usage Arguments Value Author(s) References See Also Examples
Use convert
to transform factor or character variables into
ordered integer values prior to using anchors
or
chopit
.
1 |
vars |
a character vector identifying the variables in
|
data |
data frame containing |
order |
a character vector identifying the factor levels to be
converted to integers, in increasing order. If |
... |
addtional arguments passed to |
A data frame, with the character or factor variables identified in vars
replaced by integers.
Olivia Lau
Jonathan Wand, Gary King and Olivia Lau. (2007) “Anchors: Software for Anchoring Vignettes”. Journal of Statistical Software. Forthcoming. copy at http://wand.stanford.edu/research/anchors-jss.pdf
1 2 3 4 5 6 7 8 9 10 11 | set.seed(391)
a <- sample(c("net gain", "little effect", "modest loss", "major loss"),
20, replace=TRUE)
dta <- as.data.frame( list(ncost=a) , stringsAsFactors = FALSE)
print(dta)
newdat <- convert("ncost", data = dta,
order = c("net gain", "little effect", "modest loss", "major loss"))
print(newdat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.