[R] Loop and function

livia yn19832 at msn.com
Thu Jul 5 12:16:44 CEST 2007


Hi All, I am trying to make a loop for a function and I am using the
following codes. "p" and "var" are some matrix obtained before. I would like
to apply the function  "gpdlow" for i in 1:12 and get the "returnlow" for i
in 1:12. But when I ask for "returnlow" there are warnings and it turns out
some strange result. 

for (i in 1:12){  
gpdlow <- function(u){      
p[,i]$beta -u*p[,i][[2]]
}
returnlow <- gpdlow(var[,i][var[,i]<(p[,i][[2]])
}


-- 
View this message in context: http://www.nabble.com/Loop-and-function-tf4028854.html#a11443955
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list