[R] question about user written function (newb question)

2012-02-26 Thread knavero
Quick newb question about R relating to the line of code below: rawCool = read.zoo(cooling.txt, FUN = as.chron, format = %m/%d/%Y %H:%M, sep = \t, aggregate = function(x) tail(x, 1)) I'm wondering what the specifics are for the argument where it has aggregate = function(x) tail(x, 1). I

Re: [R] question about user written function (newb question)

2012-02-26 Thread R. Michael Weylandt
Short answer to a very good question: one has to use function(x) tail(x, 1) syntax to avoid using the default tail(x, 6). There are some other ways to achieve the same thing, but I think this syntax is generally preferred for its clarity. Other question: yes I believe so. Michael On Sun, Feb

Re: [R] question about user written function (newb question)

2012-02-26 Thread Gabor Grothendieck
On Sun, Feb 26, 2012 at 9:06 AM, knavero knav...@gmail.com wrote: Quick newb question about R relating to the line of code below: rawCool = read.zoo(cooling.txt, FUN = as.chron, format = %m/%d/%Y %H:%M, sep = \t, aggregate = function(x) tail(x, 1)) I'm wondering what the specifics are for