Robert D. Bowers
2016-Apr-17 16:56 UTC
[R] Solved: Communication in for() loop (Linux version)
Thanks for the advice I've received. FYI - It turns out that the problem was connected to the way R handles pipes and FIFOs, compared to the way the socat command does. (I don't know exactly what, but trying different things solved it!) I found that if you use FIFO() in R AND set up a FIFO connection in a terminal and then use SOCAT to communicate, it becomes reliable (at least for sending commands to a UDP connection). I wasn't sure what exactly a FIFO connection was like (not that much info), but it worked. I'll try getting data FROM the UDP connection at another time. Next - figure out how to build a multi-dimensional array i.e. data(x,y,z...) with different-sized dimensions. I've got a "system" kludged together that does it (putting the data into a OpenOffice spreadsheet), but I'd rather have R do the work. That's this evening's experimentation/lesson! Bob
I am not exactly sure what YOU mean by a "multidimensional array," but I do know what R means: all elements must be the same mode (e.g all numeric, all character, etc.) . See ?array for how to do this in R if this accords with what you want to do. BTW, searching rseek.org, google, and/or using the search capabilities in the sos package may help facilitate your efforts if you are not already using these resources. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Apr 17, 2016 at 9:56 AM, Robert D. Bowers <n4fbz at tampabay.rr.com> wrote:> Thanks for the advice I've received. > > FYI - It turns out that the problem was connected to the way R handles pipes > and FIFOs, compared to the way the socat command does. (I don't know > exactly what, but trying different things solved it!) > > I found that if you use FIFO() in R AND set up a FIFO connection in a > terminal and then use SOCAT to communicate, it becomes reliable (at least > for sending commands to a UDP connection). I wasn't sure what exactly a > FIFO connection was like (not that much info), but it worked. > > I'll try getting data FROM the UDP connection at another time. > > Next - figure out how to build a multi-dimensional array i.e. data(x,y,z...) > with different-sized dimensions. I've got a "system" kludged together that > does it (putting the data into a OpenOffice spreadsheet), but I'd rather > have R do the work. That's this evening's experimentation/lesson! > > Bob > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.