Masked objects when loaded. Does this make it impossible for the package to perform its function? How to resolve?

Asked

Viewed 44 times

2

I’m having trouble executing some Spacialpoint Dataframe object commands. When I load the packets, two of them appear masked by others.

I know that masking occurs when two packages have functions with the same names. Masked objects prevent the package from performing its function? Does this make it impossible for the package to perform its function? How to "unmask" these packages so I can use the packages correctly?

The following message appears:

> library("raster")

Attaching package: ‘raster’

The following objects are masked from ‘package:MASS’:

    area, select

> library("rgdal")
rgdal: version: 1.5-8, (SVN revision 990)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.0.4, released 2020/01/28
Path to GDAL shared files: C:/R/R-3.6.3/library/rgdal/gdal
GDAL binary built with GEOS: TRUE 
Loaded PROJ runtime: Rel. 6.3.1, February 10th, 2020, [PJ_VERSION: 631]
Path to PROJ shared files: C:/R/R-3.6.3/library/rgdal/proj
Linking to sp version:1.4-2
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.

> library("adehabitatHR")
Carregando pacotes exigidos: adehabitatMA
Registered S3 methods overwritten by 'adehabitatMA':
  method                       from
  print.SpatialPixelsDataFrame sp  
  print.SpatialPixels          sp  

Attaching package: ‘adehabitatMA’

The following object is masked from ‘package:raster’:

    buffer

Ao executar o search() para ver quais funções estão mascaradas apareceu os seguintes:
> search()

 [1] ".GlobalEnv"           "package:ggplot2"      "package:VTrack"       "package:foreach"     
 [5] "package:adehabitatHR" "package:adehabitatLT" "package:adehabitatMA" "package:rgdal"       
 [9] "package:raster"       "package:sp"           "package:CircStats"    "package:boot"        
[13] "package:MASS"         "package:ade4"         "package:deldir"       "tools:rstudio"       
[17] "package:stats"        "package:graphics"     "package:grDevices"    "package:utils"       
[21] "package:datasets"     "package:methods"      "Autoloads"            "package:base"

I appreciate the help.

1 answer

6

You can specify from which package to use the function with ::

rgdal::buffer()
raster::buffer()

It is always recommended to specify from which package we are using the function as shown above.

What’s more, you can access a function with the :: without loading the package with the library().

Browser other questions tagged

You are not signed in. Login or sign up in order to post.