Hi R-helpers,
I need to read some file with different lines (I don't know the number of
lines to skip) and I would like to find a way to start reading the
data.frame from the word source.
ex:
djhsafk
asdfhkjash
shdfjkash
asfhjkash #those lines contain numbers and words, I want to skip
Sorry, the explanation wasn't very good...just to explain better.
I am writing a loop to read and process different files in the same script.
And what I want to load into a variable is a data.frame that is above the
word source in all of my files.
So I would like to recognize the word Source in
Sorry, the explanation wasn't very good...just to explain better.
I am writing a loop to read and process every time a different file in the
same script.
And what I want to load into a variable each time is a data.frame that is
bellow the word source in all of my files.
So I would like to
It might be easier to preprocess the file before passing it
to R, but you an do what you want using a connection:
f = file('s.dat','r')
while(1){
+ txt = readLines(f,1)
+ if(length(grep('Source',txt)))break;
+ }
while(1){
+ more = readLines(f,1)
+ if(nchar(more) == 0)break;
+ txt =
Sorry, this isn't really an R solution, but here it goes anyway. You
can isolate the block from Source to the first following blank line by
the following unix/linux/cygwin command, assuming inFile is your input
file and outFile is the output file:
cat inFile | grep -A 100 Source | grep -m 1 -B
On Fri, Oct 29, 2010 at 6:34 PM, M.Ribeiro mresende...@yahoo.com.br wrote:
Hi R-helpers,
I need to read some file with different lines (I don't know the number of
lines to skip) and I would like to find a way to start reading the
data.frame from the word source.
ex:
djhsafk
asdfhkjash
6 matches
Mail list logo