[R] Optimization of a function using optim

Suzen, Mehmet msuzen at gmail.com
Mon Jun 17 09:11:31 CEST 2013


Dear Graham,

On 16 June 2013 02:08, Graham McDannel <graham.mcdannel at gmail.com> wrote:
> I am attempting to optimize a function I have developed using optim.
>
> I am getting the below error message:
>
> Error in n < 1: 'n' is missing
>

I suspect a function requires an argument named n, and you
didn't pass one.  Either in your objective function or in optim.
See blow example that produce a similar error:
> f <- function(n) {
+    if(n <1) {
+     print("one")
+    }
+ }
> f()
Error in n < 1 : 'n' is missing


Best Wishes,
-m



More information about the R-help mailing list