R/itsmisc.R

as.list.its <- function(x,...) {
	result <- if (ncol(x) == 1) list(x)
	else lapply(seq(length = ncol(x)), function(i) x[,i])
	names(result) <- colnames(x)
	result
}

as.data.frame.its <- function(x, row.names = NULL, optional = FALSE, ...) {
	result <- lapply(as.list(x), I)
	result$check.names <- result$check.rows <- optional
	do.call(data.frame, result)
}
armstrtw/its documentation built on May 10, 2019, 1:42 p.m.