R/format.R

Defines functions conv_encode_to_mat

conv_encode_to_mat <- function(encode.data)
{
	var.set <- sort(unique(unlist(encode.data)))
	encode.mat <- matrix(FALSE, nrow = length(encode.data), ncol = length(var.set))
	if (nrow(encode.mat)==0 | ncol(encode.mat)==0)
		return(NULL)
	encode.data.match <- lapply(encode.data, function(x,t) match(x,t), t = var.set)
	for (i in 1:length(encode.data.match)){
		encode.mat[i,encode.data.match[[i]]] <- TRUE
	}
	encode.mat
}
zhixingfeng/rGDA documentation built on Jan. 18, 2021, 3:18 p.m.