R/transformVarNames.r

Defines functions transformVarNames

Documented in transformVarNames

transformVarNames <- function(dat, name){
    nams <- names(dat)
    if (is.null(nams) == TRUE){nams <- dimnames(dat)[[1]]}
    ns <- nchar(nams)
    out <- rep(NA, length(ns))
    for (i in 1:length(ns)){
        space <- ""
        for (j in 1:(max(ns) - ns[i] + 1)){
            space <- paste(space, " ", sep = "")
        }
        out[i] <- paste(nams[i], space, '<- ', name, '[ ,"', nams[i], '"]', sep = "")
    }
    return(cat(matrix(out, ncol = 1), sep = "\n"))
}

Try the reporttools package in your browser

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

reporttools documentation built on Oct. 12, 2021, 5:06 p.m.