[R] Einlesen von Daten unter R
Torsten Steuernagel
Torsten.Steuernagel at gmx.de
Sat Jun 12 12:12:59 CEST 2004
Hello Oscar,
I reply in English because that's the language used on this list.
> Die Verwendung der beiden Programme Labview und R ist unpraktisch. Es
> stellt sich daher die Frage, ob serielle Daten auch über R eingelesen
> werden können oder ob das R-Programm in ein Labview-Programm eingebaut
> werden kann.
I don't know Labview so I can't say anything about the possibility to integrate R into
Labview or vice versa. I did a quick search on CRAN but haven't found anything related
to Labview. If you simply want to avoid Excel, you might check if Labview supports other
output formats than Excel. Most applications are able to write data to plain text files
which R handles easily.
I don't think that there is a special serial communications library for R but since the
serial devices are treated as special files on Win32 (I assume you're using Windows, on
Unix it's similar), you can use R's I/O functions to access your COM ports. I suggest you
read the help for connections (? connections) to get an overview of R's I/O connections
as well as the help for functions like cat, write, scan, readBin, writeBin etc. To get an
idea, the following code will dial my internet provider (T-Online) using my Notebook's
modem connected to COM1:
handle <- file("com1", open="r+b")
cat("ATD0191011\r\n", file=handle)
close(handle)
If that approach will work for you depends on the requirements of the device you want
to control. R, as far as I know, doesn't provide functions that let you configure your
serial port (i.e. baut rate, timeouts, handshakings and so on). You might try to configure
those from a Windows command line (aka "DOS box") using the MODE command.
Otherwise, you need to write some C functions that interface with the Windows API to
set up the device control block accordingly. Furthermore, you should also read the
comments on blocking vs. non-blocking I/O modes in the help for connections.
> Ich wäre sehr froh, wenn Sie mir in dieser Sache behilflich sein
> könnten. Ebenso möchte ich gerne Näheres über R erfahren. Zur
> Verfügung steht mir bisher das bekannte Büchlein über R und eine
> Beschreibung "Message Boxes in R TclTk".
You should check the "Publications" section on the R homepage (http://www.r-
project.org/doc/bib/R-publications.html) for a list of R and S related publications. As a
start I recommend reading the manuals that come with R, especially "An Introduction to
R".
BFN,
Torsten
More information about the R-help
mailing list