Skip to content
Prev 343191 / 398513 Next

unable to use functions require DLL from package

David Winsemius <dwinsemius <at> comcast.net> writes:
loaded.
provokes the
error, nor are you providing the
interpolator
(and at the
moment I have way too many packages loaded:
(which
neither of the postings to which you
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:
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: