search for: myfunction2

Displaying 5 results from an estimated 5 matches for "myfunction2".

Did you mean: myfunction
2017 Jun 06
3
Force argument to have quotes
...in the example function below, myFuncton1. Below is a minimal, reproducible example of the issue with comments. ### This is a sample structure of the configuration file scoreConfig <- structure(list(Function = c("myFunction1", "myFunction1", "myFunction1", "myFunction2", "myFunction2"), Argument = c("arg1", "arg2", "arg3", "arg1", "arg2"), Value = c("5", "10", "Hello", "5", "10"), Class = c("numeric", "numeric", "character&...
2012 Jul 13
1
functions of vectors : loop or vectorization
...0.5 -1.5 -2.5 -3.5 [4,] 1.0 0.0 -1.0 -2.0 -3.0 [5,] 1.5 0.5 -0.5 -1.5 -2.5 Of course, my real life problem is a bit more complicated and runs in days ... I didn't find a straightforward way to do this using the apply family. I did a small script that works. Here it is : c = 1:5; d = 1:5; myfunction2 = function(c,d){optimize(function(x){c*x-(x+d)^2},c(-10,10),maximum=TRUE)$maximum}; v.myfunction2 = Vectorize(myfunction2, c("c","d")); outer(c, d, v.myfunction2); all.equal(myresults,outer(c, d, v.myfunction2)); [1] TRUE I was quite happy with my trick of separating and wrapp...
2017 Jun 06
0
Force argument to have quotes
...myFuncton1. > > Below is a minimal, reproducible example of the issue with comments. > > ### This is a sample structure of the configuration file > > scoreConfig <- structure(list(Function = c("myFunction1", "myFunction1", "myFunction1", > "myFunction2", "myFunction2"), Argument = c("arg1", "arg2", "arg3", > "arg1", "arg2"), Value = c("5", "10", "Hello", "5", "10"), Class = c("numeric", > "numeric", "ch...
2008 Jul 25
0
nlminb--lower bound for parameters are dependent on each others
...ose to each other. I have several parameters (say,param1, param2) and their constraints are given as inequality and depend on each other. For example, param1>=0, param1 + param2*c1>=0 (c1 is a known positive constant) When I wrote my program as: ... myfunction1 <-function(param ){..} myfunction2 <-function(param ){..} #param1=param[1] #param2=param[2] ... while (difference.Params>eps){ ... res1 <- nlminb(param.new2, myfunction1, lower = c(0, -c1/res1$par[1]), upper = Inf) param.new1<-res1$par res2 <- nlminb(param.new1, myfunction2, lower = c(0, -c1/res2$par[1]), uppe...
2011 Oct 13
1
pass an element in a list() from R to C
...EAL(VECTOR_ELT(A, 1))[0] to read each element from the list, however, it still does not work... if using SEXP as object type is the currect way to do it, could anyone give an example of how to extract element from the list in the c code? and also, when I claim the function in C, should it be SEXP myfunction2(SEXP *list) or SEXP myfunction2(SEXP list) these things are really confusing me.... Thank you for going through this post... Any helps are appreciated. Ruoqing -- View this message in context: http://r.789695.n4.nabble.com/pass-an-element-in-a-list-from-R-to-C-tp3900221p3900221.ht...