1

I write

install.packages("geoR")
library(geoR)
.nlmP(f,parameters)

and it returns

Error: could not find function ".nlmP"

What to do?

I did what the first answer suggest, then it said

Error in get(".ind.prof.phi", pos = 1) : object '.ind.prof.phi' not found
www
  • 38,575
  • 12
  • 48
  • 84
Jaood
  • 385
  • 1
  • 2
  • 12
  • 3
    Why do you want to use this function in the first place? If it's not exported then the author doesn't intend for it to be used by the end user. – Dason Apr 05 '17 at 15:47
  • What other package is available for constrained, non-linear optimization in R? – Jaood Apr 05 '17 at 15:51
  • Why are you calling this particular hidden function in the first place? Are you following a guide or something. What exactly is the desired output. This function is a private function not meant to be called directly. – MrFlick Apr 05 '17 at 15:52
  • I use "nlm" usually, and so I googled "nlm constraints". It showed up. – Jaood Apr 05 '17 at 15:55

2 Answers2

1

Actually I think we're quick to judge here.

https://github.com/cran/geoR/blob/a516861572ad6be3c2452a7b187af946130cf439/inst/CHANGES

The CHANGES file specifies that .nlmP was supposed to be exported in 1.7-2 and looking through the history it was. It wasn't until 1.7-4 or 1.7-5 that it got commented out in the NAMESPACE file. There is a note "changes to fix issues on CRAN reported errors/warnings regarding namespaces and foreign calls" so it might have been a namespace issue but it does seem the author intended for the function to be exported.

It might make sense to contact the maintainer about this.

If you absolutely need this function you could install the latest version that had it exported.

library(devtools)
install_github("cran/geoR", ref = "74feb80")

Note that you won't have any of the changes made to the package after that commit.

With that said I'm fairly sure there are better packages for contstrained non-linear optimization so hopefully somebody comes along with a better answer to get at the actual root of your problem.

Dason
  • 60,663
  • 9
  • 131
  • 148
0

You must use geoR:::.nlmP(), because nlmP is not in the exported NAMESPACE for geoR.

dank
  • 841
  • 1
  • 8
  • 15
  • This did not work. It produces Error in get(".ind.prof.phi", pos = 1) : object '.ind.prof.phi' not found – Jaood Apr 05 '17 at 15:44
  • 1
    I don't know the specifics of this package and funciton, but it looks as though it's using some other elements that are *not exported* from the package. Sometimes this is easy to fix, and other times it would be easier simply to download the package source, add the desired function to the NAMESPACE, and rebuild. But it's worth noting that most package authors have thought carefully about which functions to export. Possibly you can get what you want using exported functions. – dank Apr 05 '17 at 15:49