R/formatvar.R

formatvar <-
function(x){
	if(is.data.frame(x)){
		newx <- x
		newx <- newx[,!colnames(newx) %in% c("date", "age")]
		#newx$datenum <- 0
		newx <- unique(newx)
		form1 <- formatvar0(newx, exep=c("ind", "datenum"))
		return(form1)
	}
	else{
		form0 <- lapply(x, function(z){
                    zz <- z[,!colnames(z) %in% c("date")]
                    return(formatvar0(zz))
                })
		form1 <- do.call("c", form0)
		names(form1) <- unlist(lapply(strsplit(names(form1), "\\."), function(x) x[-1]))
		return(form1)
	}
}

Try the CMRCT package in your browser

Any scripts or data that you put into this service are public.

CMRCT documentation built on May 2, 2019, 6:44 p.m.