Extract final values from one run of a simulation

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:


Global Moderator
Try something like this:

## Make a test file

## Read only one file
read.table(con,skip=999,nrow=1) #read only the 999-th line

## clean up