[R] unable to use functions require DLL from package
Lotte de Vries
lotte.devries2 at student.uva.nl
Sat Aug 16 10:54:24 CEST 2014
David Winsemius <dwinsemius <at> comcast.net> writes:
>
> Well I do have the MASS package from which that function was
loaded.
>
> I get no error with the example in the help page:
>
> boxcox(Days+1 ~ Eth*Sex*Age*Lrn, data = quine,
> lambda = seq(-0.05, 0.45, len = 20), plotit=TRUE)
>
> ... and you are not providing a reproducible example that
provokes the
error, nor are you providing the
> version numbers of R or MASS.
>
> >
> > as I do miss some symbol names.
> >
> > How can I overcome this serious problem ?
> > ***********************************
> > ************************************
> > Subject: Missing "spline_coef" DLL and Rob Hyndmans monotonic
interpolator
> >
> >
> > x <- seq(0,4,l=20)
> >
> > y <- sort(rnorm(20))
> >
> > plot(x,y)
> > lines(spline(x, y, n = 201), col = 2) # Not necessarily monotonic
> > lines(cm.spline(x, y, n = 201), col = 3)
>
> I get no error after:
>
> library(demography)
>
> # And then running that code.
>
> I have an almost up-to-date version of R running on a mac
(and at the
moment I have way too many packages loaded:
>
> > sessionInfo()
> R version 3.1.0 Patched (2014-04-21 r65431)
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] grDevices datasets splines graphics utils stats
> [7] grid methods base
>
> other attached packages:
> [1] demography_1.17 ftsa_3.9 rainbow_3.2
> [4] pcaPP_1.9-49 forecast_5.4 timeDate_3010.98
> [7] zoo_1.7-11 XML_3.98-1.1 RCurl_1.95-4.3
> [10] bitops_1.0-6 subplex_1.1-4 MASS_7.3-31
> [13] cobs_1.2-2 quantreg_5.05 gplots_2.13.0
> [16] reshape2_1.2.2 ggplot2_0.9.3.1 multcomp_1.3-1
> [19] TH.data_1.0-3 mvtnorm_0.9-9999 data.table_1.9.2
> [22] muhaz_1.2.5 downloader_0.3 RJSONIO_1.3-0
> [25] plot3D_1.0-1 rms_4.2-0 SparseM_1.03
> [28] Hmisc_3.14-4 Formula_1.1-1 survival_2.37-7
> [31] sos_1.3-8 brew_1.0-6 lattice_0.20-29
>
> loaded via a namespace (and not attached):
>
> So that shows you how to provide some of the needed information
(which
neither of the postings to which you
> resonded had done.) PLEASE read the Posting Guide.
>
>
> David Winsemius
> Alameda, CA, USA
>
>
Hi David,
Let me try this again, apologies.
I'm trying to run the package posum
(http://www.maths.bath.ac.uk/~sw283/simon/posum.html),
which is an old package and therefore relies on an old version
of the package mgcv (version 0.8-7).
I'm trying to run these packages using R version 3.1.0 on
windows 8 computer( x86_64-w64-mingw32/x64 (64-bit)).
When I run the example code given in the posum package I get
an error. The code I'm trying to run is:
data<-population.data(fam="p",adult=TRUE) #simulate data
b<-posum(data,fam="p")
The second line gives an error and a warning:
Error in .C("spline_coef", method = as.integer(method),
n = n, x = as.double(x), :
"spline_coef" not available for .C() for package "stats"
In addition: Warning message:
In if (d < 0) stop("d can not be negative in call to
null.space.dimension().") :
the condition has length > 1 and only the first element
will be used
The part of the posum code that this error refers to is the
following:
cm.splinefun<-function(x, y = NULL, method = "fmm",gulim=0)
# modification of base package splinefun to produce co-monotonic
#interpolant
# by Hyman Filtering. if gulim!=0 then it is taken as the upper
# limit on the gradient.
{ x <- xy.coords(x, y)
y <- x$y
x <- x$x
n <- length(x)
method <- match(method, c("periodic", "natural", "fmm"))
if (is.na(method))
stop("splinefun: invalid interpolation method")
if (any(diff(x) < 0)) {
z <- order(x)
x <- x[z]
y <- y[z]
}
if (method == 1 && y[1] != y[n]) {
warning("first and last y values differ in spline -
using y[1] for both")
y[n] <- y[1]
}
z <- .C("spline_coef", method = as.integer(method), n = n,
x = as.double(x), y = as.double(y), b = double(n),
c = double(n), d = double(n),
e = double(if (method == 1) n else 0), PACKAGE = "stats")
z$y<-z$y-z$x*gulim # trick to impose upper
z$b<-z$b-gulim # limit on interpolator gradient
z<-hyman.filter(z) # filter gradients for co-monotonicity
z$y<-z$y+z$x*gulim # undo trick
z$b<-z$b+gulim # transformation
z<-spl.coef.conv(z) # force other coefficients to consistency
rm(x, y, n, method)
function(x) {
.C("spline_eval", z$method, length(x), x = as.double(x),
y = double(length(x)), z$n, z$x, z$y, z$b, z$c, z$d,
PACKAGE = "stats")$y
}
}
And finally:
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=
English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] posum_2.0-0 mgcv_0.8-7
loaded via a namespace (and not attached):
[1] tools_3.1.0
I hope this is a more acceptable formulation of the problem!
Best wishes,
Lotte de Vries (Master student theoretical biology)
On Sat, Aug 16, 2014 at 3:24 AM, David Winsemius <dwinsemius at comcast.net>
wrote:
>
> On Aug 15, 2014, at 2:56 PM, Charlotte de Vries wrote:
>
> > David Winsemius <dwinsemius <at> comcast.net> writes:
> >
> >>
> >>
> >> On Aug 15, 2014, at 8:06 AM, Charlotte de Vries wrote:
> >>
> >>> Hey there!
> >>>
> >>> I'm having problems with the same code, but I get a different error:
> >>
> >> This is apparently yet another example demonstrating why the Posting
> Guide
> > suggests that you include the
> >> text of any earlier posting to which you want us to consider. At the
> > moment I see no posting that has this subject.
> >>
> >>>
> >>> Error in .C("spline_coef", method = as.integer(method), n = n, x =
> >>> as.double(x), :
> >>> "spline_coef" not available for .C() for package "stats"
> >>>
> >>>
> >>> I'm using R3.1.0 on windows 8 and I've never used R before, so I might
> > have
> >>> made some terrible newby error (I have programmed quite a bit before,
> > but in C
> >>> and Matlab).
> >>>
> >>> Thank you!
> >>>
> >>> Best,
> >>
> >> David Winsemius
> >> Alameda, CA, USA
> >>
> >>
> >
> > Hi David,
> >
> > Thank you for answering. The original message I replied to was this
> message
> > (http://comments.gmane.org/gmane.comp.lang.r.general/113245):
> >
> > **********************************************
>
> Well, that explains why I don't have a copy on my machine. It's dated 6
> May 18:15 2008
>
>
> > Hi all,
> >
> > I have issues using some basic functions in R such as these ones :
>
> pp.test is not a "basic R function". I get this:
>
> > ?pp.test
> No documentation for ‘pp.test’ in specified packages and libraries:
> you could try ‘??pp.test’
>
> You are asked to include the package name for non-base R functions.
>
> >
> >> pp.test(R) (where is a vector of returns)
> > Error in .C("R_approx", as.double(x), as.double(y), as.integer(nx), xout
> =
> > as.double(xout), :
> > C symbol name "R_approx" not in DLL for package "base"
> >
> >> boxcox(reg,plotit=T) (where reg is an lm object)
> > Error in .C("spline_coef", method = as.integer(method), n =
> as.integer(nx),
> > :
> > C symbol name "spline_coef" not in DLL for package "base"
>
> Well I do have the MASS package from which that function was loaded.
>
> I get no error with the example in the help page:
>
> boxcox(Days+1 ~ Eth*Sex*Age*Lrn, data = quine,
> lambda = seq(-0.05, 0.45, len = 20), plotit=TRUE)
>
> ... and you are not providing a reproducible example that provokes the
> error, nor are you providing the version numbers of R or MASS.
>
>
> >
> > as I do miss some symbol names.
> >
> > How can I overcome this serious problem ?
> > ***********************************
> >
> > But someone else reported a very similar problem (oddly enough using the
> > same function spline_coef but this time from the package stats rather
> than
> > base (http://comments.gmane.org/gmane.comp.lang.r.general/115420):
>
> Which was in turn dated: 2 Jun 06:04 2008
>
>
> > ************************************
> > Subject: Missing "spline_coef" DLL and Rob Hyndmans monotonic
> interpolator
> >
> > Hello R help
> >
> > I have been trying to use Rob Hyndman's monotonically increasing spline
> > function. But like another user or two seem have a problem with a
> > missing DLL (namely "spline_coef"). None of the previous help postings
> > seemed to have any solutions to this problem. As per a Ripley
> > suggestion I have deleted all previous versions of R and reinstalled R
> > 2.7.0 and the problem persists.
> >
> > Thanks
> >
> > Paul.
> >
> > x <- seq(0,4,l=20)
> >
> > y <- sort(rnorm(20))
> >
> > plot(x,y)
> > lines(spline(x, y, n = 201), col = 2) # Not necessarily monotonic
> > lines(cm.spline(x, y, n = 201), col = 3)
>
> I get no error after:
>
> library(demography)
>
> # And then running that code.
>
> I have an almost up-to-date version of R running on a mac (and at the
> moment I have way too many packages loaded:
>
> > sessionInfo()
> R version 3.1.0 Patched (2014-04-21 r65431)
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] grDevices datasets splines graphics utils stats
> [7] grid methods base
>
> other attached packages:
> [1] demography_1.17 ftsa_3.9 rainbow_3.2
> [4] pcaPP_1.9-49 forecast_5.4 timeDate_3010.98
> [7] zoo_1.7-11 XML_3.98-1.1 RCurl_1.95-4.3
> [10] bitops_1.0-6 subplex_1.1-4 MASS_7.3-31
> [13] cobs_1.2-2 quantreg_5.05 gplots_2.13.0
> [16] reshape2_1.2.2 ggplot2_0.9.3.1 multcomp_1.3-1
> [19] TH.data_1.0-3 mvtnorm_0.9-9999 data.table_1.9.2
> [22] muhaz_1.2.5 downloader_0.3 RJSONIO_1.3-0
> [25] plot3D_1.0-1 rms_4.2-0 SparseM_1.03
> [28] Hmisc_3.14-4 Formula_1.1-1 survival_2.37-7
> [31] sos_1.3-8 brew_1.0-6 lattice_0.20-29
>
> loaded via a namespace (and not attached):
> [1] caTools_1.16 cluster_1.15.2 colorspace_1.2-4
> [4] descr_1.0.3 dichromat_2.0-0 digest_0.6.4
> [7] fracdiff_1.4-2 gdata_2.13.3 gtable_0.1.2
> [10] gtools_3.4.0 hdrcde_3.1 KernSmooth_2.23-12
> [13] ks_1.9.1 labeling_0.2 latticeExtra_0.6-26
> [16] Matrix_1.1-3 mgcv_1.7-29 misc3d_0.8-4
> [19] munsell_0.4.2 nlme_3.1-117 nnet_7.3-8
> [22] parallel_3.1.0 plyr_1.8.1 proto_0.3-10
> [25] quadprog_1.5-5 RColorBrewer_1.0-5 Rcpp_0.11.1
> [28] rgl_0.93.996 sandwich_2.3-0 scales_0.2.3
> [31] stringr_0.6.2 tools_3.1.0 tseries_0.10-32
> [34] xtable_1.7-3
>
>
> So that shows you how to provide some of the needed information (which
> neither of the postings to which you resonded had done.) PLEASE read the
> Posting Guide.
>
>
> >> Error in .C("spline_coef", method = as.integer(method), n = nx, x = x,
> > :
> > C symbol name "spline_coef" not in DLL for package "stats"
> >
> > Cm.spline code from
> > http://www-personal.buseco.monash.edu.au/~hyndman/Rlibrary/interpcode.R
> > **********************************
> >
> > I hope that helps, thank you :)! I've tried calling spline_coef from both
> > stats and base, but I get the same error for both packages. I've also
> tried
> > the solution suggested to these people, which was to remove any other R
> > versions on my laptop.
> >
> > Best,
> > Lotte
> >
> >
>
> David Winsemius
> Alameda, CA, USA
>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list