Re:RStudio: Integrated development environment (IDE) for R
by t-kalinowski on Wednesday March 20, 2024 @01:55PM
(#39769959)
R does have namespaces. Take a look at the NAMESPACE file found at the root of every R package, which defines the symbols and methods exported by the package.
Note for many R packages, the NAMESPACE file is autogenerated from roxygen docs: https://cran.r-project.org/web/packages/roxygen2/vignettes/n...
Re:RStudio: Integrated development environment (IDE) for R
by _Wintermute on Wednesday March 20, 2024 @02:46PM
(#39770482)
> which defines the symbols and methods exported by the package
Which are all dumped into the one single global namespace regardless if you want everything or not.
I can't remember the exact number, but tidyverse package imports literally thousands of things into your global namespace on package load, coupled with any other dependencies and you have a hell of a time figuring out where any function or constant came from.
Re:RStudio: Integrated development environment (IDE) for R
by mjhay on Wednesday March 20, 2024 @03:48PM
(#39771202)
Calling library() is kind of an antipattern in production R code. You can either call namespaced functions (like say dplyr::mutate()), or use roxygen.
Re:RStudio: Integrated development environment (IDE) for R
by disgruntledphd2 on Wednesday March 20, 2024 @04:27PM
(#39771625)
Agreed but the GP isn't wrong. It's much much nicer to import a library with an alias in Python.
It doesn't have modules or namespaces, and the current fashion is for packages to use non-standard evaluation which adds friction to user's writing their own functions.