I need some suggestions on how to solve this problem. I have a number of zoo objects on which I want to perform a Causal Impact analysis in R, using the homonym package developed by Google. To automatize the process, I want to run a loop over the zoo objects and automatically save the results in a file to be exported in either word or csv.
So far, my solution has been to include the zoo objects into a zoo list by
zoolist<-list(ts1,
ts2,
ts3
)
and then run a for loop like:
for (i in zoolist)
{
experiment_impact<-CausalImpact(i,
pre.period,
post.period,
model.args = list(nseasons = 7, season.duration = 1))
summary(experiment_impact)
}
The code seems to work, however I don't have idea on how to export all the outputs in a csv or doc or whatever format, provided that it is compact and readable.
Any idea? Thank you for your help!