R/readIn.R

Defines functions readIn

Documented in readIn

readIn <- function(ncol, nlines, ...) {
  x <- matrix(scan(,"", quiet=TRUE, nlines=nlines), ncol=ncol, byrow=TRUE)
  x <- as.data.frame(x, ..., stringsAsFactors = FALSE)
  names(x) <- x[1,]
  x <- x[-1,]
  rownames(x) <- 1:nrow(x)
  for( i in 1:ncol(x)){
    x[,i] <- if(all(is.na(suppressWarnings(as.numeric(x[,i]))))){ x[,i] }else{ as.numeric(x[,i]) }
  }
  return(x)
}

Try the nwfscDeltaGLM package in your browser

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

nwfscDeltaGLM documentation built on May 2, 2019, 6:30 p.m.