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
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"))
This may have been solved by now; however, try setting the PACKAGE argument for the .C call in SolarSpectrum.PAR to "SolarSpectrum" (this may involve altering the package source files for SolarSpectrum.PAR). That may get R to look in the correct namespace (I haven't actually tried this, but it worked for a different package with the same error).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.