I should have a simple question, but I am very new to R, so it is stumping me.
I have a series of 25 columns representing a test in a behavioral experiment. I would like to use the roll for the amount in the first 5 columns, then 6-10, 11-15 and so on, so that I can end up with the 5 column data frame with the output (similar to the 5 column sample) below). In fact, the point should be able to change the "size of bin" fast so that I can decide how "resolution" shows the data best. In the end I will not just be briefly, but I think this answer will be enough to get me rolling.
INPUT: Col1 Col2 Col3 Col4 Col5 1 1 1 2 2 2 2 Input: Call 1 5 10 INPUT Assuming there is a dataframe, probably something like this:
sapply (0: ((length (lens) -1) / 5, function (x) sum (INPUT [ , 5 * x + 1: 5])) I do not think zoo :: rollapply is considered as rolling in columns.
No comments:
Post a Comment