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 leads
Hi,
On Sun, Apr 1, 2012 at 8:27 PM, Hurr hill0...@umn.edu 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
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)
main
[1] main title
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)
linDta -
4 matches
Mail list logo