Skip to content
Prev 165030 / 398506 Next

Trouble pulling data from a messy ASCII file...

I usually use Unix tools to process really data beforehand (sed, awk), but
if you want a pure R solution it is usually possible to kludge
something together
with scan() working line by line.

# read a line
# if it contains stuff you aren't interested in, go on to the next line
# if it contains one kind of interesting stuff, do X
# if it contains another kind of interesting stuff, do Y

and so on.

I've done this when it was easier than alternative processing (though
slower), and
found that it worked best for  me to read the entire line in as a
string, then split it
apart later and convert to numeric if appropriate.

Sarah
On Wed, Dec 17, 2008 at 2:37 PM, Titan8883 <jplaney at gmail.com> wrote: