Hi:

Not sure, but perhaps you had something like this in mind:

y <- runif(100)
w <- matrix(y, nrow = 10)       # fills in column-wise
v <- apply(w, 2, cumsum)
plot(1:100, y, type = 'l', col = 'blue')
lines(1:100, as.vector(v), type = 'l', col = 'red')

Reshaping into a matrix and using apply() to produce column-wise cumulative
sums seems like what you were after. The difference between the overall
cumulative sum (of y) and the column-wise cumulative sums is shown in the
graph.

HTH,
Dennis

On Tue, Feb 1, 2011 at 1:51 AM, Surrey Jackson <surreyjackson@gmail.com>wrote:

> Hello,
>
> I have some data where a number of events (the total amount varies)
> occur at cumulating times,  I would like to create a scatterplot
> (easily achieved using plot etc) of these events (the events can
> either be times using poxist or I can convert them into just seconds
> which is probably easier to work with), however I would like the
> events/times to re-begin plotting every 10th occurrence and start
> being plotted again from 0 on the Y axis.  The result would be a
> scatte rplot that looks like it has lots of ups and downs in it, as
> opposed to one that just keeps on going on up and up and up.  This
> would allow me to compare the time of the events across multiple
> sessions of data.
>
> Now I can create a scatterplot of the first 10 occurrences and then
> minus the 10th time from the next 10 occurrences so the times will be
> plotted correctly on the Y axis.  However I can't make them plot in
> the 11:20 slot.
>
> I have read all the help files for plot, dotchart etc and can't figure it
> out.
>
> I am after an elegant solution as I have many hundreds of data files
> that I will need to do this for and I have been creating all my other
> graphs and doing other anaylsis using a loop and all the files have
> varying numbers of events to be plotted.
>
> Any help would be greatly appreciated.
>
> Regards
>
> Surrey Jackson
>
> ______________________________________________
> 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.
>

	[[alternative HTML version deleted]]

