[R] How to capture output from a subprocess?

Ronggui Huang ronggui.huang at gmail.com
Sun Jun 14 07:32:32 CEST 2009


## open a pipe
a <- pipe("mplayer -slave -quiet /media/wind/Music/a.mp3","w")
write("get_file_name",a) ## send get_file_name command to player.
## ANS_FILENAME='a.mp3'
write("quit",a) ## exit mplayer

Can I capture the output from mplayer into a R object? In this case,
it is "ANS_FILENAME='a.mp3'". I try sink(), but it doesn't work as
what I want to capture is not a return from R.

Thanks.

-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html




More information about the R-help mailing list