# Testing Packages Locally

After you have either created a package or downloaded a package from a repository, you can test the package functions by running the example files in the TERR engine. Then you can write your own scripts using the package functions, and test them using Spotfire Analyst.

## Before you begin

Your Spotfire Analyst installation should be configured to use the local TERR engine. You can check this option from the Spotfire Analyst menu by clicking Tools > Options. In the Options dialog, click Data Functions, and make sure Use locally-installed Spotfire Enterprise Runtime for R engine is selected.

## About this task

Perform this task from your Spotfire Analyst installation.

## Procedure

1. From the menu, click Tools > TERR Tools.
2. Click Launch TERR Console.
   The TERR engine console that is included in the Spotfire Analyst Modules folder is displayed in a separate window.
3. At the prompt, type `library(packagename)` to load the package.
   The package is loaded to the package directory.
4. Type or paste the script or example using the package functions that you want to run.

## Testing a package example

    #install the package
    install.packages("survival")
    #load the package
    library(survival)
    #run the example
    Surv(heart$start, heart$stop, heart$event)