Reputation: 9858
I came across this in the following context from B. Pfaff's "Analysis of Integrated and Cointegrated Time Series in R"
## Impulse response analysis of SVAR A−type model 1
args (vars ::: irf.svarest) 2
irf.svara <− irf (svar.A, impulse = ”y1 ” , 3
response = ”y2 ” , boot = FALSE) 4
args (vars ::: plot.varirf) 5
plot (irf.svara)
Upvotes: 22
Views: 23578
Reputation: 1
The “::” is a symbol of scope resolution, it is used in C++ Programming Language as well as R Programming Language to reference a library. For example, in C++ we use "using namespace std" so you don't have to type std::cout every time, instead you could simply type “cout”. Although, most C++ developers prefer the syntax of “std::cout” for scope resolution to the library that is defined. In R once you load the library you can directly use the functions defined within the library without the scope resolution since all the functions are loaded once you use the library("package-name") or require("package-name"). For instance, if you don't load the "dplyr" package in order to use any of its defined functions, you need to use the dplyr::function-name such as dplyr::select/pull/filter/glimpse/and-man-other-functions. However, once you use library('dplyr') or require('dplyr"), then all the functions that are defined in the dplyr package is available for use, so you can directory use 'select or pull, or glimpse, or filter and many others'. The base class is loaded by default in R language so that is why all the functions that are defined in the R "base" package are always available.
Upvotes: -1
Reputation: 100204
From the help file (you can see this with help(":::")
):
The expression 'pkg::name' returns the value of the exported
variable 'name' in package 'pkg' if the package has a name space.
The expression 'pkg:::name' returns the value of the internal
variable 'name' in package 'pkg' if the package has a name space.
In other words :::
is used to directly access a member of a package that is internal (i.e. not exported from the NAMESPACE).
See this related question: R: calling a function from a namespace.
Upvotes: 24