hypertidy / lazyraster

raster data via GDAL on-demand
https://hypertidy.github.io/lazyraster/
27 stars 1 forks source link

plot.lazyraster Roxygen: `plot()` and masking-related messages on package load #20

Closed brownag closed 3 years ago

brownag commented 3 years ago

When loading lazyraster I get the following messages:

library(lazyraster)
#> 
#> Attaching package: 'lazyraster'
#> The following object is masked from 'package:graphics':
#> 
#>     plot
#> The following object is masked from 'package:base':
#> 
#>     plot

I think reworking lines 66-71 in lazy-methods.R

https://github.com/hypertidy/lazyraster/blob/5588c0639d3e300bc7165560b864e3cbe8d405e5/R/lazy-methods.R#L66-L71

with something like...

# ...
#' @method plot lazyraster
#' @name plot
#' @rdname lazyraster-plot
#' @export

would get rid of the masking messages and show the lazyraster method in the ?plot help along with other methods

image

mdsumner commented 3 years ago

thanks! I think it's right now, much better :)

brownag commented 3 years ago

works perfect, thank YOU for this great package + {vapour}

brownag commented 3 years ago

Whoops, looks like I was mistaken. When passing lazyraster as argument after loading the package (without message), I get the following error

Error in as.double(y) : 
  cannot coerce type 'S4' to vector of type 'double'

Removing @name lazyraster-methods and replacing @aliases plot with @name plot seems to work for me; then using @rdname lazyraster-methods makes sure the plot method goes with the print/format methods.

brownag commented 3 years ago

And I was doubly-mistaken. Sorry for all the noise Your fix was perfect, I tried on different machine and was actually passing a raster object since I called as_raster on it. My bad.

mdsumner commented 3 years ago

oh, great - thanks :)