Re: [R] Result error using the function

2015-10-06 Thread Adams, Jean
I have simplified your function. And I have transposed your results such that resulting metrics are in columns rather than rows. So, it's not exactly what you were after, but perhaps you will find it useful. monthly_summary <- function(dt, r, tol=1E-6) { # number of days with above tol by year

[R] Result error using the function

2015-10-06 Thread smart hendsome
Hi R-users, I am new to R.  I try to code using the function in R as below:  monthly_summary <- function(dt,r) {  tol <- 1E-6    mn  <- vector(length=12, mode="numeric")    lambda  <- vector(length=12, mode="numeric")    ag  <- aggregate(dt[,4] > tol, list (dt[,2], dt[,1]), sum)    names(ag) <- c