[R] littler+dget+stdin -> segmentation fault

John Lawrence Aspden news at aspden.com
Fri Jan 5 00:55:58 CET 2007


Jeffrey Horner wrote:

> John Lawrence Aspden wrote:
>> Hi, I'm trying to write a series of pipes using littler, and I get the
>> following behaviour: 
>> 
>> $ r -e 'a<-dget(file=stdin()); print(a)'
>> ?list(a=2)
>> Segmentation fault
> 
> You've found a bug which has been fixed. Expect a new version 0.0.9 of
> littler later tonight from here:
> 
> http://dirk.eddelbuettel.com/code/littler/
> 
> What exactly are you trying to accomplish?


Hi Jeff, that's gratifying! Thanks.

I'm trying to write some scripts to process the output from a brain scanner, 
using some routines which someone else wrote to use interactively in R.

The idea is to hide R from the end-user so that as far as they're concerned 
it's just a normal unix filter. Indeed the end-user is probably going to be 
another program eventually.

However the first process is a time consuming wavelet transform and 
correlation step, and then there are loads of possibilities for what to do 
with the result.

so I want to be able to say:

process1 <brain.data >processed.data (time consuming)

to do the hard bit, and then e.g.

process2 <processed.data
process3 <processed.data | graphing-tool

to produce various visualizations and statistics

I'm using dput/dget to read and write the intermediate structure (a list of 
matrices). All the other methods seem to remember the structure's original 
name and then stick it in the global namespace, which I find annoying. I
also like the fact that dput/dget work with text files, which means that
one day I'll be able to drop in a replacement for process1 written in C to
deal with anticipated huge data sets.

This seems to be working well so far (I'm only prototyping to see if it's 
feasible), but I'm having to work around the bug by having the file as a 
command line argument rather than piping it in.

Cheers, John.

-- 
Contractor in Cambridge UK -- http://www.aspden.com



More information about the R-help mailing list