# Single Trajectory

Open the file `examples/cain/WilkinsonSMfSB/ch06-lv.xml`, which models the Lotka-Volterra system. Generate a single trajectory using the defined model and method by clicking the launch button . Next click the export button in the simulation output panel. This will bring up the export configuration window shown below. You may read the Exporting Data section in the Visualization and Analysis chapter for an explanation of its features.

Click the export button and enter "lv" in the file dialog to create the data file `lv.csv`. Launch R and set the working directory to where you have saved the data file. For myself, this is "Development/cain". Read the CSV (Comma Separated Values) file and have a look at the first few lines.

    > setwd('Development/cain')
    > lv.df <- read.csv('lv.csv')
    > head(lv.df)
      Time Prey Predator
    1    0   50      100
    2    1   93       79
    3    2  159       84
    4    3  255      132
    5    4  269      283
    6    5  141      434

To make a time series data structure, we drop the first column. We could simply define the starting time to be zero and the time increment to be one. However, to show the general method, below we have used the time values in first column. By default, plotting the time series data will yield separate plots.

    > lv.ts <- ts(lv.df[,-1], start=lv.df[1,1], deltat=lv.df[2,1]-lv.df[1,1])
    > plot(lv.ts)

You can also put the species together in a single plot.

    > plot(lv.ts, plot.style='single')