Displaying 1 result from an estimated 1 matches for "lamda_cor".
2010 May 17
1
sapply code
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")
for (i in 1:n)
{ term[i] <- (dt[i]/n)*log(dt[i]/n) }
#sum(term)
cxn <-...