From ae3f061b2b520e53c66a1e86c625da09909197f4 Mon Sep 17 00:00:00 2001 From: Lars Vilhuber Date: Mon, 21 Oct 2024 08:54:08 -0400 Subject: [PATCH] Update 13-environments-in-other.md --- 13-environments-in-other.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/13-environments-in-other.md b/13-environments-in-other.md index b10211d..ee0f29c 100644 --- a/13-environments-in-other.md +++ b/13-environments-in-other.md @@ -1,7 +1,28 @@ (environments-other)= # Using environments in other languages -R (via the `renv`) functionality, and Julia (natively, using the `Project` functionality) have similar functionality. MATLAB programs can also manipulate the [search path](https://www.mathworks.com/help/matlab/ref/path.html), which is done for plugins and other functionality, for instance when adding [Dynare](https://www.dynare.org/) as a plugin. They all work the same way. +Search paths, and the ability to manipulate the search path and thus create environments, exist in most other languages that have some notion of modularity and user-contributions. While not always as easy to manipulate, the basic functionality is the same. + +## R + +R has one or more `library paths`, which can be viewed and manipulated via the `.libPaths()` function. For instance, one might create a project-specific library path, into which all packages are installed, and from which all functions are read, as follows: + +```{.R} +rootdir <- here::here() +.libPaths(file.path(rootdir,"libraries")) +``` + +A more refined management of project-specific environments and specific software packages can be achieved via the [`renv`](https://rstudio.github.io/renv/articles/renv.html) library. + +## Julia + +Natively, using the `Project`/[`Pkg.jl`](https://pkgdocs.julialang.org/v1/) functionality. + +## MATLAB + +MATLAB programs can manipulate the [search path](https://www.mathworks.com/help/matlab/ref/path.html), which is done for plugins and other functionality, for instance when adding [Dynare](https://www.dynare.org/) as a plugin. + +More generally, MATLAB's Search Path collects the various native MATLAB features, official and user-provided toolboxes (packages), and defines the order in which they are found. See for more details. ## Takeaways @@ -29,4 +50,4 @@ This does not ensure ### What to do next -To solve some of these problems, let's go to the next step. \ No newline at end of file +To solve some of these problems, let's go to the next step.