View source: R/cleanUpAttempt.R
cleanUpAttempt | R Documentation |
An attempt to clean-up messy vectors
cleanUpAttempt(messy, cluster = FALSE, ngroup = NULL, graph = TRUE, h = NULL)
messy |
a factor vector |
cluster |
logical |
ngroup |
integer giving the number of cluster to be formed |
graph |
logical plot or not hclust |
h |
numeric scalar or vector with heights where the tree should be cut |
use stringdist package. examples from https://cran.r-project.org/web/packages/rrefine/vignettes/rrefine-vignette.html
void or cleaned-up factor
JuG
x <- c("Y", "Y,", "Yes", "N", "No",NA,"No","No","No","Nope","Yes","Yes","Yes")
cleanUpAttempt(x)
cleanUpAttempt(x,ngroup = 2)
cleanUpAttempt(x, h=2)
xc <- cleanUpAttempt(messy = x,ngroup = 2, cluster = TRUE)
summary(xc)
xd <- cleanUpAttempt(messy = x,h = 2, cluster = TRUE)
summary(xd)
# install.packages("devtools")
devtools::install_github("vpnagraj/rrefine")
library(rrefine)
summary(lateformeeting$what.day.whas.it) #What a mess!
cleanUpAttempt(messy = lateformeeting$what.day.whas.it)
cleaned <-cleanUpAttempt(messy = lateformeeting$what.day.whas.it,ngroup = 5,cluster=TRUE)
summary(cleaned)
cleanUpAttempt(messy = lateformeeting$was.i.on.time.for.work,ngroup=2)
raw <- c("persistante modérée à sévère", "Persistante modérée a sévère","légère", "persistante modérée à sévère",
"persistante légère", "persistante modérée à sévère","persistante modérée à sévère",
"persistante modérée à sévère","persistante modérée à sévère", "persistante modérée à sévère","rien à voir",
"persistante modérée à sévère",NA, "persistante modérée à sévère",
"persistante légère","persistante modérée à sévère", "autre solution","persistante modérée,à sévère",
"persistante modérée à sévère","persistante modérée à sévère", "persistante légère","persistante modérée à sévèr",
"persistante légère", "persistant modérée à sévère")
cleanUpAttempt(messy = raw)
cleanUpAttempt(messy = raw,ngroup=4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.