mkm {Kmisc}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

mkm(obj, numcol = NA, colname = NA, rowname = NA, title = NA, obs = NA)

Arguments

obj ~~Describe obj here~~
numcol ~~Describe numcol here~~
colname ~~Describe colname here~~
rowname ~~Describe rowname here~~
title ~~Describe title here~~
obs ~~Describe obs here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

~Make other sections like Warning with section{Warning }{....} ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(obj, numcol=NA, colname=NA, rowname=NA, title=NA, obs=NA) {
  rowname <- ifelse(is.na(rowname), "", rowname)
  colname <- ifelse(is.na(colname), "", colname)
  title <- ifelse(is.na(title), "", title)
  if (is.na(numcol)) {
    numcol <- ncol(obj)
    title <- c(title, rep("", numcol))
    colname <- c("", colname, rep("", numcol-1))
    x <- as.matrix(obj)
    x <- cbind(rownames(obj), x)
    x <- rbind(c(rowname, colnames(obj)), x)
  }
  else {
    title <- c(title, rep("", numcol))
    colname <- c("", colname, rep("", numcol-1))
    x <- cbind(rownames(obj), as.matrix(obj), matrix("", nrow(obj), numcol-ncol(obj)))
    x <- rbind(c(rowname, colnames(obj), rep("", numcol-ncol(obj))), x)
  }
  if (is.list(obs)) {
    obs <- sapply(obs, function(x) {
      if(any(is.na(x)))
        rep("", numcol+1)
      else
        c(x, rep("", numcol-length(x)+1))
    })
    obs <- t(obs)
  }
  else {
    obs <- if(any(is.na(obs)))
      rep("", numcol+1)
    else
      c(obs, rep("", numcol-length(obs)+1))
  }
  return(rbind(title, colname, x, obs))
  }

[Package Kmisc version 1.0 Index]