[R] Help with for
a s
datamanagement at email.com
Tue Feb 15 01:11:09 CET 2000
I haven't been able to solve two issues, really appreciate any help.
Q1. Why this one goes like that? (could it be a bug?):
What I want:
> J_c(1,2,3)
> MA_NA
> MA[1]_min(J[1:2])
> MA[2]_min(J[2:3])
> MA
[1] 1 2
Good, so now lets do it a little more faster (since the real vectors have
over 15000 obs):
> for (i in 1:2) MA[i]_min(J[i:i+1])
> MA
[1] 2 3
It does the same with any function instead of min.
Q2. The former type of job works better with sapply (or the like), but when
FUN returns a vector, I haven't been able to get a matrix instead of a list
(simplify=TRUE, does not make any difference). Any way to avoid converting
list into matrix after sapply??
Thank you very much,
Alex Ahgarin
Data Management Dpt.
IDS
Washington, US
-----------------------------------------------
FREE! The World's Best Email Address @email.com
Reserve your name now at http://www.email.com
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list