根据条件生成新的一列Affairs$ynaffair[Affairs$affairs > 0] <- 1

Affairs$ynaffair[Affairs$affairs == 0] <- 0

Affairs$ynaffair <- factor(Affairs$ynaffair, levels=c(0,1), labels=c("NO","YES"))

生成90个连续的日期start.date <- as.Date("2015-01-01")

dates <- seq(from=start.......