R Handling 2 Functions with Same Name in Different Packages (Example Code)
In this article, I’ll illustrate how to specify the package from which a function should be taken in the R programming language.
Example: Specifying Package Name befor Application of Function
install.packages("chron") # Install & load chron library("chron") |
install.packages("chron") # Install & load chron library("chron")
is.weekend(Sys.Date()) # Apply is.weekend function of chron package # FALSE |
is.weekend(Sys.Date()) # Apply is.weekend function of chron package # FALSE
install.packages("tseries") # Install & load tseries library("tseries") |
install.packages("tseries") # Install & load tseries library("tseries")
is.weekend(Sys.Date()) # is.weekend function does not work anymore # Error in is.weekend(Sys.Date()) : function is only for irts objects |
is.weekend(Sys.Date()) # is.weekend function does not work anymore # Error in is.weekend(Sys.Date()) : function is only for irts objects
chron::is.weekend(Sys.Date()) # Specify package name befor application # FALSE |
chron::is.weekend(Sys.Date()) # Specify package name befor application # FALSE