using zoo for daily stock prices
See aggregate.zoo and maybe ?rollapply For date manipluations see R News 4/1 help desk article and the table at the end of that article, in particular. Suggest you also read and follow the last line on every r-help message when posting.
On 12/10/06, Alfonso Sammassimo <cincinattikid at bigpond.com> wrote:
Hi all, Please forgive this newbie posting to the list for the first time if I haven't followed proper procedure. I have read through many of the archives and find them most useful in learning R. I have ten years daily data (stock closing prices) which I read in zoo format. I am having problems coding R to run a count of how many days in each month have a price higher than the first day of that month. I then wish to compare counts for all months. Along these lines, is there a simple way to index to certain dates(eg first of month, last of month, any specific date in one month) and keep looping over each month using such a reference point, and then assessing the results for each month? Any guidance would be sincerely appreciated, Alfonso Sammassimo Melbourne, Australia.
______________________________________________ R-help at stat.math.ethz.ch 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.