# TERRprofile

The optional TERRprofile files can contain R code that is run in the TERR session global enviornment so that objects created in them are visible to the user.

TERRprofile files can be defined in two places:

- The site-specific file in TERR_HOME (for example, in etc/TERRprofile)
- The user-specific file in ./.TERRprofile (or in ~/.TERRprofile if ./.TERRprofile does not exist).

If TERR encounters an error while running any code in TERRprofile, it does no further processing of the file but continues the startup sequence.

A profile file is run early in the startup sequence. You can depend on only the base package being loaded when they are run. You can use `loadNamespace("pkg")` or `library("pkg")` to load or attach other packages. Alternatively, you can use the double-colon syntax, such as `pkg::func()` to load the package `pkg` and run its function `func` as part of the startup sequence.

If you want to start a session and bypass running the TERRprofile files, you can use one of the following techniques.

- Use the command line options `--no-site-file` and `--no-init-file`, referring to the site-specific and user-specific profile files, respectively.
- Use the command-line option `--vanilla`.

You can use nonstandard-named TERRprofile files by defining the environment variables `TERR_PROFILE` and `TERR_PROFILE_USER`, setting the name to the site-specific and user-specific profile files, respectively.
Note: TERR does not report warnings or errors if these files do not exist.

## Example

Add the following line of code to the file TERR_HOME\etc\TERRprofile.site. When you next start TERR, the RinR package loads.

    library("RinR")