R/remove_comments_from_lines.R

Defines functions remove_comments_from_lines

Documented in remove_comments_from_lines

#' Remove comments at the beginning of a vector of strings
#' 
#' @param lines Vector of strings, typically obtained from using \code{scan} with \code{sep='\n'}.
#' @return Vector of strings without the commented lines.
#' @export
remove_comments_from_lines <- function(lines)
{
  i <- 0
  while(i==0) ifelse(substr(lines[1], 1,1)=='#', lines <- lines[-1], i<-1)   
  #if(i==1) cat('Comments removed\n')
  return(lines)
}
rogiersbart/rtoolz documentation built on Aug. 20, 2020, 2:48 p.m.