# Extract final values from one run of a simulation

#### michaelmarks

##### New Member
I ran a simulation using R and because there were a large number of permutations (>10,000) we stored the output of each permutation in a separate file.

For each permutation we did 1000 runs of the simulation.
The attached file contains the 1000 runs that make up one of these permutations.
I want to pull the tail values the key variables (labelled S,I1,I2,L) of each run in to a table.

When i do
df <- tail(X,1) R generates a new dataset containing all the information from the last 1000 runs.
I had thought that if I then did
tail (df,1)
it would give me the penultimate value of the that specific run but no go.

Suggestions welcomed.

Last edited:

#### michaelmarks

##### New Member
Missing attachment to accompany above post

#### TheEcologist

##### Global Moderator
Try something like this:

Code:
## Make a test file
write.table(1:1000,file="myfilename")

file.remove('myfilename')