R/post.R

Defines functions check.post make.post

make.post <- function(data) {
  post <- vector("character", length = ncol(data))
  names(post) <- colnames(data)
  post
}

check.post <- function(post, data) {
  
  if(is.null(post)) return(make.post(data))
  
  # check
  if (length(post) != ncol(data))
    stop("length(post) does not match ncol(data)", call. = FALSE)
  
  # change
  if (is.null(names(post))) names(post) <- colnames(data)
  
  post
}

Try the mudfold package in your browser

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

mudfold documentation built on Nov. 24, 2022, 5:09 p.m.