mydf <- function(x){
if (is.data.frame(x)){
} else {
stop("You must pass a data frame as an argument!")
}
if (eval(nrow(x) < 1)){
stop("Your data frame must have at least one row!")
}
var_names <- colnames(x)
class1 <- sapply(x, class)
var_unique <- lengths(lapply(x, unique))
var_na <- colSums(is.na(x))
dfout <- data.frame(var_names, class1, var_unique,var_na, row.names = NULL)
dfout
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.