Re: [R] sapply code

2010-05-16 Thread Henrique Dallazuanna
Try this: 1 + (1 / log(length(lambda_cor))) * sum((l <- lambda_cor / length(lambda_cor)) * log(l)) On Sun, May 16, 2010 at 10:43 PM, Roslina Zakaria wrote: > Hi r-users, > > I have this code here, but I just wonder how do I use 'sapply' to make it > more efficient > > lamda_cor <- eigen(winter_

[R] sapply code

2010-05-16 Thread Roslina Zakaria
Hi r-users,   I have this code here, but I just wonder how do I use 'sapply' to make it more efficient lamda_cor <- eigen(winter_cor)$values   > lamda_cor [1] 1.3459066 1.0368399 0.8958128 0.7214407   lamda_cxn <- function(dt) { n   <- length(dt)   term    <- vector(length=n, mode="numeric")