[R] Creating a new connection type

Claudia Beleites cbeleites at units.it
Fri Oct 10 17:23:00 CEST 2008

Dear Paulo,

> Hello. I have an instrument, actually a step motor indexer that I want to
> drive from R. It uses an RS-232 connection. I already have a few C
> subroutines that I access from R but I would like to be able use R's
> connection related functions - readLines, writeLines, cat, read.table, etc
> - directly. Does any one have any suggestions on how a I should proceed to
> create a new connection type? Is it even possible without going down to R's
> guts?
I've played with an RS 232 connection from R some months ago:

For sending it is convenient to use a connection to the serial port as file
e.g. file = "COM1:" or "/dev/ttyS0"

I got into trouble with reading. It works fine with the file connection as 
long as really an answer is waiting - otherwise the timeout is too long for 
this being a practical solution. I could neither figure out how to change 
this timeout nor how to find out whether data is waiting (e.g. like 

HTH and if you figure out how to read nicely, please let me know.


Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 2
I-34127 Trieste

phone: +39 (0 40) 5 58-34 47
email: cbeleites at units.it

More information about the R-help mailing list