fork download
  1. d <- "2016-07-02" # input month
  2. Periods.No <- c(2301, 3287)# Input No of Periods
  3. b <- -6027#Input a number
  4. class(b) <- "Date"
  5. Periods.Duration <- c(10, 7)# Input the duration of the Peiods
  6. cat("Data frame showing the result of forwarding a specified number of periods of a specified duration from ", as.character(as.Date(b,origin = "1970-01-01"))," : \n\n")
  7. df <- data.frame(Periods.No, Periods.Duration, stringsAsFactors=FALSE)
  8. df <- transform(df, Dates = b + Periods.No * Periods.Duration)
  9. df[nrow(df) + 1, ] <- c((as.POSIXlt(d)$year - as.POSIXlt(b)$year)*12 + as.POSIXlt(d)$mon - as.POSIXlt(b)$mon, round((as.POSIXlt(d) - as.POSIXlt(b))/((as.POSIXlt(d)$year - as.POSIXlt(b)$year)*12 + as.POSIXlt(d)$mon - as.POSIXlt(b)$mon), digits = 2), d)
  10. df
Success #stdin #stdout 0.46s 79168KB
stdin
Date, Amount,Remarks
2016-01-31,123,0208 過年 88+35
2016-03-27,93,0329 wedding Sandy No. 2 $115
2016-05-23,120,0528 wedding reception
2016-06-26,100, very short haircut 
2016-07-30,115,Planned  Sandy No. 2 $115 
stdout
Data frame showing the result of forwarding  a specified number of periods of a specified duration from  1953-07-02  : 

  Periods.No Periods.Duration      Dates
1       2301               10 2016-07-01
2       3287                7 2016-06-30
3        756            30.44 2016-07-02