Re: [R] Reading first line before using read.table()

2012-04-01 Thread Hurr
Thanks so much. The following are the actual lines I used for testing, and they worked. titleline <- readLines("C:/ad/dta/TryRRead/pureCos2.dta", n=1) print(titleline) dta <- read.table("C:/ad/dta/TryRRead/pureCos2.dta", skip = 1, header = TRUE, sep = ",", colClasses = "character") linDt

Re: [R] Reading first line before using read.table()

2012-04-01 Thread jim holtman
try this: > # test data > temp <- tempfile() > writeLines(text = "main title line + a b # table header + 1 2 + 3 4 + 5 6", temp) > input <- file(temp, 'r') # connection for reading > > # read main > main <- readLines(input, n = 1) > rest <- read.table(input, header = TRUE) > close(input) > > mai

Re: [R] Reading first line before using read.table()

2012-04-01 Thread Steve Lianoglou
Hi, On Sun, Apr 1, 2012 at 8:27 PM, Hurr wrote: > So far I have figured out that the following line > reads our time series files into R OK. > dtLs$dta <- read.table("C:/TryRRead/datFiles/JFeqfi4h.rta", header = TRUE, > sep = ",", colClasses = "character") > But I have to remove a main-title line

[R] Reading first line before using read.table()

2012-04-01 Thread Hurr
So far I have figured out that the following line reads our time series files into R OK. dtLs$dta <- read.table("C:/TryRRead/datFiles/JFeqfi4h.rta", header = TRUE, sep = ",", colClasses = "character") But I have to remove a main-title line so that the first line is the column titles line. This l