NoYes = function(dat, vars, ros, ord=FALSE){
require(dplyr)
datReduced = select(dat, one_of(vars))
if(ros == 0)
likOrd = lapply(datReduced, function(x)
factor(x,
levels = c(0,1),
labels = c("No", "Yes"),
ordered=ord)
)
else {
datReduced = select(dat, one_of(vars))
likOrd = lapply(datReduced, function(x)
factor(x,
levels = c(1,2),
labels = c("No", "Yes"),
ordered=ord)
)
}
likOrd = as.data.frame(likOrd)
dat[,vars] = likOrd
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.