I have to construct a vector of date with a cycle "for". I use the function
"seq", but when I allocate in a vector, this becomes a number!!!
How do I have? thank you
Example:
dataval=as.Date("2011/07/01")
date_val=seq(dataval,length=260,by="-7 day")
date_inizio=c()
date_condizione=c()
for (k in 1:length(date_val)){
date_inizio[k]=seq(date_val[k],length=2,by="-5 years")[2]
date_condizione[k]=seq(date_val[k],length=2,by="-2 years")[2]
}
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.