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 Could some one provide some additional clarity regarding this message and what it entails, as well as, how to rectify this issue. Thanks [[alternative HTML version deleted]]
Not unless you read the Posting Guide, stop posting in HTML mail format, and provide a reproducible example. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. 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 > >Could some one provide some additional clarity regarding this message >and >what it entails, as well as, how to rectify this issue. > >Thanks > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
The r-help list should institute a prize for "Most Obtuse Question of the Month". This one should be a shoe-in for the June 2013 prize. cheers, Rolf Turner On 16/06/13 12:08, Graham McDannel 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 > > Could some one provide some additional clarity regarding this message and > what it entails, as well as, how to rectify this issue. > > Thanks
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