Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: error message --- package error: "functionName" not resolved from current namespace

Tags:

r

I am using a package that has worked up until R3.0.

the issue is as above .... when we call a function that works in R 2.15.2 from R 3.0 we get an error

Error in .C("solarspectrum3", as.double(lon), as.double(lat), as.double(timezone),  : 
  "solarspectrum3" not resolved from current namespace (SolarSpectrum)

any help would be appreciated

Alex

The package could be found at https://www.dropbox.com/s/zgspdzd2rq5jmh6/SolarSpectrum_1.0.tar.gz

install the package

R CMD INSTALL SolarSpectrum_1.0.tar.gz , then

run

require(SolarSpectrum)

longitude=2

latitude=50

date=as.POSIXct("2008-06-06")

PAR <- SolarSpectrum.PAR(longitude, latitude, date)[2]

The error should show up at this time

like image 311
user2619599 Avatar asked Aug 12 '13 16:08

user2619599


1 Answers

This error message can affect functions that call external code using calls to .C() or .Call().

The problem is described well in this R-help thread; in particular Martin Morgan's response is useful. He quotes an entry to R's NEWS file, when version 3.0.0 was released.

A foreign function call (.C() etc) in a package without a PACKAGE argument will only look in the first DLL specified in the NAMESPACE file of the package rather than searching all loaded DLLs. A few packages needed PACKAGE arguments added.

So the call to .C() or .Call() needs to be amended in the package's source, to include PACKAGE = "name_of_dll_without_extension".

You can find the DLL names with the following code.

dir(system.file("libs", package = "rpkgname"))
like image 168
Richie Cotton Avatar answered Sep 28 '22 16:09

Richie Cotton