Skip to content
Prev 168536 / 398502 Next

Ignore text when reading data

# replace this bit, replace it with your file name
myfile <- textConnection(
"Time    out1
Sec     mm
0.82495117      -0.020977303
1.3554688       -0.059330709
1.826416        -0.021419302
2.3295898       -0.051521059
2.8347168       -0.020661414


Time    out1
Sec     mm
3.8679199       -0.000439643
4.3322754       -0.063477799
4.8015137       -0.024581354
5.3286133       -0.067487299
5.8212891       -0.011978489")

# which lines not to read
notread <- c(which(r==""),grep("Time ",r),grep("Sec ",r))

# read the data as text
mydata <- r[setdiff(1:length(r),notread)]

# make it into a dataframe (I think this can be done prettier, but whatever)
z <- paste(mydata, collapse="\n")
read.table(textConnection(z))


greetings
Remko

-------------------------------------------------
Remko Duursma
Post-Doctoral Fellow

Centre for Plant and Food Science
University of Western Sydney
Hawkesbury Campus
Richmond NSW 2753

Dept of Biological Science
Macquarie University
North Ryde NSW 2109
Australia

Mobile: +61 (0)422 096908
On Thu, Jan 29, 2009 at 11:45 AM, beyar <bxx at mailinator.com> wrote: