R/adddate.R

Defines functions adddate

Documented in adddate

NULL
#'
#'  Inserts three columns (year,month,day) passing dates  to a matrix or to a dataframe
#' 
#' 
#' 
#' @param data matrix of daily data 
#' @param origin character string containing the date of the first row of \code{data} as YYYY-MM-DD
#' 
#' @seealso \code{\link{findDate}}
#' @export 
#' @return a data frame with dates and \code{data} values
#' 


adddate <- function(data,origin="1961-1-1") {
	
	
	
	if (!is.data.frame(data)) data <- as.data.frame(data)	
		
	
	dates <- findDate(1:nrow(data),origin=origin,data.frame=TRUE,decimal=FALSE,character=FALSE)
	
	out <- cbind(dates,data)
	
	
	
	return(out)
}	

Try the RMAWGEN package in your browser

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

RMAWGEN documentation built on Dec. 12, 2019, 9:07 a.m.