[R] question about user written function (newb question)
knavero
knavero at gmail.com
Sun Feb 26 15:06:42 CET 2012
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 understand that it removes the last
row of duplicates/aggregates in the zoo series. I'm confused as to why
"tail(x, 1)", a built in function in the utils package, requires the coder
to treat it as a user written function thus defining the assignment, in this
case an argument, with "function(x)". Why can't the coder just write
"tail(x, 1)" instead? Also, with the argument 'x', within tail, I'm assuming
it's looking at all columns simultaneously within the zoo series? Is that
correct to say? Thanks.
--
View this message in context: http://r.789695.n4.nabble.com/question-about-user-written-function-newb-question-tp4422187p4422187.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list