Re: [R] problem in reading trajectory file

2010-03-15 Thread Phil Spector
Arnaud - A reproducible example would be nice, but something like this might work, assuming your data is in a file called 'traj.txt': dat = readLines('traj.txt') triallines = grep('trial',dat) starts = triallines + 2 ends = c(triallines[-1] - 1,length(dat)) thetrials = sub('# *trial *(\\d+)

[R] problem in reading trajectory file

2010-03-15 Thread arnaud chozo
Hi, I'm trying to read some trajectory files (text files) which have the form: # trial n # t X Y 0 1 2 0.2 1 3 0.41.2 4 ... # trial n+1 # t X Y 0 1 2 0.2 1.3 3.3 0.4 1.5 5 ... ... where the symbol # means that the