raster::levels() not working in packaged function.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

raster::levels() not working in packaged function.

Nevil Amos
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: raster::levels() not working in packaged function.

Marcelino de la Cruz Rot
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: raster::levels() not working in packaged function.

edzer
In reply to this post by Nevil Amos


On 10/31/20 1:24 PM, nevil amos wrote:

> Apologies, I cannot see how to make a rero for this issue.
>
> I have a function that uses levels(r) tor return the RAT of a raster "r"
> when the function is sourced from a script
> source(".\R\function.r")
> it works fine.
> when the function is built into a package and sourced from there
> library(mypackage) using the same script file to make the package
> levels(r)[[1]]
> the same line throws an error, as levels(myraster returns NULL
>
> If I modify the script to include the raster namespace:
> raster::levels(r)[[1]]
> Then I get the error
>   Error: 'levels<-' is not an exported object from 'namespace:raster'

The error suggests that you are trying to assign levels, rather than
retrieve them.

>
>
> I have also tried just using levels(r) and putting raster as a depends
> rather than an import in the DESCRIPTION file for the package, this does
> not solve the error.
>
>
> Any suggestions on how to overcome the problem?
>
> many thanks
>
> Nevil Amos
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48149 Muenster, Germany
Phone: +49 251 8333081

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: raster::levels() not working in packaged function.

Nevil Amos
In reply to this post by Marcelino de la Cruz Rot
CONTENTS DELETED
The author has deleted this message.