"dummy.code" <- function(x) {
t <- table(x)
lt <- length(t)
n.obs <- length(x)
new <- matrix(0,nrow=n.obs,ncol=lt)
xlev <- as.factor(x)
for (i in 1:n.obs) {new[i,xlev[i]] <- 1}
colnames(new) <- names(t)
return(new)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.