?do.call On Fri, 2 Aug 2002, Florent BATY wrote:> Hello, > Is it possible to call a function having x arguments with vector > containing the x values of the arguments in it ? > To make myself clearer, I was wandering if from a function f: > > > f > function(a,b) a+b > > and a vector v which the 2 values of the arguments "a" and "b": > > > v > a b > 1 2 > > names(v) > [1] "a" "b" > > it is possible to call the function f with vector v as the arguments of the function. > If I use f(v) it returns me an error since v was considered as the value of the first argument. > > Do you any ideas ??-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hello, Is it possible to call a function having x arguments with vector containing the x values of the arguments in it ? To make myself clearer, I was wandering if from a function f: > f function(a,b) a+b and a vector v which the 2 values of the arguments "a" and "b": > v a b 1 2 > names(v) [1] "a" "b" it is possible to call the function f with vector v as the arguments of the function. If I use f(v) it returns me an error since v was considered as the value of the first argument. Do you any ideas ?? _______________________________________ Florent BATY CNRS UMR 5558 Dynamique des Populations Bact?riennes Facult? de M?decine Lyon-Sud 69921 OULLINS, BP 12 FRANCE tel : +33 (0)4 78 86 31 67 fax : +33 (0)4 78 86 31 49 _______________________________________ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> "FB" == Florent BATY <baty at biomserv.univ-lyon1.fr> disait:FB> Hello, Is it possible to call a function having x arguments FB> with vector containing the x values of the arguments in it ? FB> To make myself clearer, I was wandering if from a function f: >> f FB> function(a,b) a+b FB> and a vector v which the 2 values of the arguments "a" and FB> "b": >> v FB> a b 1 2 >> names(v) FB> [1] "a" "b" FB> it is possible to call the function f with vector v as the FB> arguments of the function. If I use f(v) it returns me an FB> error since v was considered as the value of the first FB> argument. FB> Do you any ideas ?? f<-function(x,y){ if (is.list(x)) { y <- x$y x <- x$x } x+y } should work. or look at the code of legend()... -- Mathieu Ros Laboratoire de G?n?tique Cellulaire, INRA Toulouse -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I have a model & data where arima0 works, but not the new arima:> PIBconstQtr1 Qtr2 Qtr3 Qtr4 1991 1599 1907 1927 1970 1992 1655 1894 1869 1952 1993 1711 1994 1892 1941 1994 1765 1936 2064 1969 1995 1834 1982 2005 2089 1996 1867 2059 2099 2075 1997 1872 2158 2114 2186 1998 1978 2175 2167 2226 1999 1971 2152 2117 2161 2000 1955 2167 2157 2206 2001 2025 2212 2175 2226 test <- arima(PIBconst, order=c(0,1,1), sea=list(order=c(0,1,1)), init=c(0.5, 0.5)) Error in optim(init[mask], armaCSS, method = "BFGS", hessian = FALSE, : initial value in vmmin is not finite with better init values: test <- arima(PIBconst, order=c(0,1,1), sea=list(order=c(0,1,1)), init=c(-0.7, -0.8)) Error in optim(init[mask], armaCSS, method = "BFGS", hessian = FALSE, : initial value in vmmin is not finite changing method: test <- arima(PIBconst, order=c(0,1,1), sea=list(order=c(0,1,1)), init=c(-0.7, -0.8), method="ML") Error in optim(init[mask], armafn, method = "BFGS", hessian = TRUE, control = optim.control, : initial value in vmmin is not finite What to do? (We have got this to work on other series, which actually contain missing values). Kjetil Halvorsen -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._