In R, I can prefix functions with the name of the package they belong to (e.g., dplyr::select
). Nevertheless, I am having problems when doing this with c
from the terra
package. I can do it fine with base::c
(should I want to):
base::c(1, 2, 3)
# [1] 1 2 3
However, I run into problems when running similar code for terra
:
# Dummy SpatRaster
foo <- terra::rast(matrix(1:9, ncol=3))
# Works fine
c(foo, foo)
# Not so much
terra::c(foo, foo)
# Error: 'c' is not an exported object from 'namespace:terra'
I am confused how c
is not an exported function of terra
and yet I can access and use it just fine... so long as I don't use a prefix.
Q: Can someone explain why this is the case and how I can explicitly refer to c
from terra
?
PS ?terra::c
gives a help page explaining how c
combines SpatRaster
objects into a new SpatRaster
object, which suggests to me that this function must've been implemented in the terra
package.