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

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

2015-10-09 Thread Rolf Turner
On 10/10/15 10:56, Adams, Jean wrote: You were very close. Try this. df <- data.frame(x5=dailyrecord$a, x6 = dailyrecord$e, x7 = dailyrecord$f) apply(df, 1, function(row) fun3(list1, list2, as.list(row))) There could in general be problems with this approach. The apply() function works on