[R] What is the threshold for `useRaster` of graphics::image()?

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Fri Oct 2 20:59:39 CEST 2020


Clearly you need to spend some more time studying basic docs on how R
works. R is open source: **all** code is available, though in different
locations and with different means to access it.

Typing:
> graphics::image
at the console returns

function (x, ...)
UseMethod("image")
<bytecode: 0x7f8d4ca1d448>
<environment: namespace:graphics>

This tells us that image() is an S3 method for the "image" generic (read
the necessary docs if you don't know what this means).

> methods("image")
[1] image.default
see '?methods' for accessing help and source code

This tells us that there is only one method with the packages I have loaded
in my session, image.default()

> image.default
now gives the code:

function (x = seq(0, 1, length.out = nrow(z)), y = seq(0, 1,
    length.out = ncol(z)), z, zlim = range(z[is.finite(z)]),
    xlim = range(x), ylim = range(y), col = hcl.colors(12, "YlOrRd",
        rev = TRUE), add = FALSE, xaxs = "i", yaxs = "i", xlab,
    ylab, breaks, oldstyle = FALSE, useRaster, ...)
{
## many lines of code
}

which includes a call to C code "C_image" for which you would have to look
elsewhere.
The R Internals doc that ships with R tells you how to find that. Or just
googling on "find C code in R" may give you more convenient options (e.g.
through the pryr package).

Cheers,

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Oct 2, 2020 at 11:28 AM <cdanek using posteo.de> wrote:

>  Hi R-help list
>
> What is the threshold for the `useRaster` argument of graphics::image()
> to decide whether a grid is "regular" or not (i.e. the usage of
> useRaster=T is allowed or not). My
> `dev.capabilities("rasterImage")$rasterImage` is "yes".
>
> I could not find this information in the internet. I also could not find
> the source code of the graphics::image() function (I would answer the
> question by myself then). Where can I find the source code?
>
> Thanks a lot for any help and kind regards,
> Chris
>
> packageDescription("graphics")
> Package: graphics
> Version: 4.0.2
> Built: R 4.0.2; x86_64-pc-linux-gnu; 2020-06-22 08:33:40 UTC; unix
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list