Displaying 1 result from an estimated 1 matches for "specialfunct".
2012 Dec 08
3
Mean-Centering Question
...eles,5/8/11,49,4.69
Los Angeles,5/15/11,40,5.05
New York,5/1/11,259,6.4
New York,5/8/11,187,5.3
New York,5/15/11,177,5.7
Paris,5/1/11,672,6.26
Paris,5/8/11,514,5.3
Paris,5/15/11,455,5.2
I want to mean-center the "Units" and "AveragePrice" Columns.
So, I created this function:
specialFunction <- function(x){ log(x) - colMeans(log(x), na.rm = T) }
If I use only "one" column in the first argument of the "by" function,
everything is in fine. For example the following code will work fine:
by(data[c("Units")],
data["Location"],
specialFunction...