Giter VIP home page Giter VIP logo

Comments (9)

rubak avatar rubak commented on June 12, 2024

Are you calling these functions without attaching first? I think the environment .spEnv is generated when the spatstat package is attached. Therefore the following will generate the error you are experiencing: spatstat::versionstring.spatstat(). Is it possible for you to attach the package (e.g. via require(spatstat)) or do you need a workaround?

from spatstat.

hackermd avatar hackermd commented on June 12, 2024

I'm using Imports in the DESCRIPTION file of my package and then call spatstat functions using the full namespace, e.g. spatstat::mppm().
Of note, this works for some spatstat objects, such as spatstat::ppp().

I would like to avoid using require(spatstat) within my package. What would you recommend?

from spatstat.

hackermd avatar hackermd commented on June 12, 2024

Attaching the spatstat package via library(spatstat) in the main script that calls function of my custom package solved the problem. The user of my package shouldn't have to attach the spatstat package, however, but only my custom package (which depends on spatstat).

from spatstat.

hackermd avatar hackermd commented on June 12, 2024

Including spatstat in Depends in the DESCRIPTION file also solves the problem. But I think it would be nicer if spatstat would use namespaces consistently.

from spatstat.

baddstats avatar baddstats commented on June 12, 2024

spatstat:::versionstring.spatstat is meant to give the version number of the currently loaded version of spatstat. I'll make a workaround for the case where spatstat is not loaded.

from spatstat.

baddstats avatar baddstats commented on June 12, 2024

This problem has been fixed in the current development version (1.44-1.016). Please try this out with your custom package and let us know if it is satisfactory.

from spatstat.

hackermd avatar hackermd commented on June 12, 2024

Using the development version, I get

Error in do.call("ppm", append(list(...), list(rbord = rbord, justQ = TRUE)), : could not find function "ppm"

The problem also affects other functions, in my case profilepl().

from spatstat.

baddstats avatar baddstats commented on June 12, 2024

In spatstat development version 1.44-1.020 we have fixed this latest problem.

If you still encounter namespace problems using this version, then your package effectively requires the spatstat namespace to be imported. I'd suggest that your package DESCRIPTION file should declare that it Imports: spatstat, and the NAMESPACE file should declare either

import(spatstat)

or at least

importFrom(spatstat, ppm, profilepl, etc, etc, etc)

including the names of all the spatstat functions that are needed to prevent namespace problems.

from spatstat.

hackermd avatar hackermd commented on June 12, 2024

Putting import(spatstat) in the NAMESPACE file did the trick. Thanks!

from spatstat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.