Re: [R] [FORGED] Re: R lappy, sapply or mapply question

2015-10-10 Thread liqunhan--- via R-help
Dear Rolf and Adams, Thanks for your help! works perfectly.though all columns are of the same type,  for "safe", it is changed from data.frame to data.matrix as follows: dmatrix <- data.matrix(dailyrecord[c("a", "e", "f")]) colnames(dmatrix) <- c("x5", "x6", "x7") apply(dmatrix, 1, function(row) fu

[R] R lappy, sapply or mapply question

2015-10-09 Thread liqunhan--- via R-help
Hello, R-experts, In R-program, I have a question about the apply-family. I want to use apply-family to replace a for-loop in my R-code,But, lapply returns a list of 3 (each component is the same), sapply returns a matrix, and mapply with error message. how to use apply-family function so that