swh:1:snp:0f920b1e114986636ba2e45b5c1a83473fb6cf12
Raw File
Tip revision: 12acd76ec1d613505e4bb20b3012e8d8507a310a authored by Lars Kotthoff on 16 May 2018, 20:38:09 UTC
version 0.31
Tip revision: 12acd76
misc.R
as.simple.formula <- function(attributes, class) {
	return(as.formula(paste(class, paste(attributes, sep = "", collapse = " + "), sep = " ~ ")))
}

get.data.frame.from.formula <- function(formula, data) {
	d = model.frame(formula, data, na.action = NULL)
	for(i in 1:dim(d)[2]) {
		if(is.factor(d[[i]]) || is.logical(d[[i]]) || is.character(d[[i]]))
			d[[i]] = factor(d[[i]])
	}
	return(d)
}

entropyHelper <- function(x, unit = "log") {
    return(entropy(table(x, useNA="always"), unit = unit))
}
back to top