Displaying 20 results from an estimated 2000 matches similar to: "2 questions about signal & broken connection in R"
2013 Jun 25
5
How can C++ read the R object written into socket with saveRDS or save
Hi, all,
Recently, I met one issue when using socket between R & C++ to transmit R
object. Would you pls help give me some suggestions? Many thanks!
[Background]:
I create a socket connection between R & C++ binary first, and then, want
to use saveRDS() or save() in R to save the object into connection
directly. So that the C++ binary can read the object, and send it to
another remote R.
2013 Jun 25
5
How can C++ read the R object written into socket with saveRDS or save
Hi, all,
Recently, I met one issue when using socket between R & C++ to transmit R
object. Would you pls help give me some suggestions? Many thanks!
[Background]:
I create a socket connection between R & C++ binary first, and then, want
to use saveRDS() or save() in R to save the object into connection
directly. So that the C++ binary can read the object, and send it to
another remote R.
2013 Jul 02
3
Ctrl+C in R will terminate the child process which is spawned by using "pipe"
Hi, all,
I pressed Ctrl+C in R process, and found that the child process which was
spawned by using "pipe" is terminated due to this.
Are there any way to work around it, so that the child process can run
happily without being terminated? Or can we block the signal for the child
process?
1. I used pipe to spawn one C++ process, which will running in a loop
without exiting immediately.
2019 Dec 06
2
long vector support
All,
At first glance, a recent commit to R-devel (
https://github.com/wch/r-source/commit/2c182014ecc8c2407a89092c9162d86046bd18da)
appears to be related to long vector support. But as Henrik Bengtsson
points out at
https://github.com/HenrikBengtsson/Wishlist-for-R/issues/97#issuecomment-562659134,
writeBin() still prohibits long vectors. Are there any plans to add long
vector support to R
2002 Oct 07
2
Error in writeBin(object, con, size = 2)
Hi all,
I wrote a function (in R batch mode) which reads binary data,
interpolates sometimes and wrote a new binary file of the same size as
the input file. Her is a bit of code:
while (length( head <- readBin(si, integer(), 64, size=2))) {
data <- readBin(si, integer(), head[5], size=2)
## now write head to new file
writeBin(head, so, size=2)
## if head[4] is 9 or
2003 Apr 25
2
Open an r+b file connection on Windows
I am trying to open an existing binary file, seek to a position in the
middle, and then write one byte, while keeping the already existing data
after that byte. It seems to me that I am unable to open a connection to a
binary file in both read and write mode. I can open the "r+b" binary file
connection and seek around, but I can't write to the file. And looking at
the function
2001 Dec 07
2
Memory problem
Dear all,
I have written a little R program to convert images. See below. Within the
loop over j (the filenames) memory consumption grows constantly. rm( ... )
inside the loop did not help. Memory does not grow if I remove the writeBin
statements between the two #-------- marks. But obviously this is not
solution I want...
Thanks for any advice.
Manfred Baumstark
P.S. As I'm new to R:
2002 Nov 29
2
readBin or writeBin adds extra nulls (PR#2333)
Full_Name: Ken Yap
Version: 1.6.1
OS: Linux (SuSE 8.0)
Submission from: (NULL) (129.78.64.5)
I'm trying to copy a file using readBin and writeBin. (The reason is to be able
to pipe PostScript or PDF output to a socket later, this is just an experiment.)
I do:
zz <- file("foo.ps", "rb")
r <- readBin(zz, character(), 1000000)
yy <- file("bar.ps",
2011 Feb 04
2
Strange behaviour of read and writeBin
To me it seems like writeBin() writes one char/byte more than expected.
> con <- file("testbin", "wb")
> writeBin("ttccggaa", con)
> close(con)
> con <- file("testbin", "rb")
> readBin(con, what="character")
[1] "ttccggaa"
> seek(con, what=NA)
[1] 9
> close(con)
> con <-
2001 Jul 17
1
How to write the bytes 00 01 00 to a file/connection?
Is there any way to write (8-bit) bytes to a file which works on all [R]
platforms? I have been looking at
1) writeBin
2) writeChar
3) cat
and neither of them manage to write arbitrary sequences of bytes (0-255).
For instance, I would like to create a binary file of length three
containing the bytes 0, 1 and 0. I [R] I have the following vector of bytes:
bfr <- c(0,1,0)
1) For
2010 Jan 07
2
Problem with writeBin and importing into gfortran compiled programs
Hi all,
I'm having problems trying to export binary arrays from R and importing
them into fortran (linux openSUSE 10.3 (x86_64), gfortran compiler,
fortran 90/95 program).
Let's say the problem can be expressed as:
R part
------------
>whini <- runif(1000)
>writeBin(whini,"fwhini.dat")
f90 part
------------
PROGRAM foo
INTEGER, PARAMETER :: DP = KIND(1.0D0)
INTEGER ::
2009 Apr 30
2
NA_real_ <op> NaN -> NA or NaN, should we care?
On Linux when I compile R 2.10.0(devel) (src/main/arithmetic.c in
particular)
with gcc 3.4.5 using the flags -g -O2 I get noncommutative behavior when
adding NA and NaN:
> NA_real_ + NaN
[1] NaN
> NaN + NA_real_
[1] NA
If I compile src/main/arithmetic.c without optimization (just -g)
then both of those return NA.
On Windows, using a precompiled R 2.8.1 from CRAN I get
NA for
2010 Jun 16
2
Sending a null byte to a socket
Hello,
I am trying to write some code in R to communicate over sockets via the
STOMP protocol (http://stomp.codehaus.org/Protocol).
As you can see, a null byte (ASCII 0) is used as the "over" signal.
I'd like to be able to do something like this:
write.socket(socket, "CONNECT\nlogin: me\npasscode: pass\n\n\000")
However, R does not like it when you put "\000"
2005 Oct 12
1
Questions about readBin function (Was: dec2bin?)
Hi,
The latest version of R had some changes to functions "readbin() and
writeBin() [which] now support raw vectors as well as filenames and
connections.". As a result I am working on retiring "raw2bin" and "bin2raw"
functions from "caTools" package which do exactly the same. Thanks to Prof.
Ripley for bringing this change to my attention.
Which brings me
2011 Jun 17
1
Message7(06/16/2011) Re: error when booting (Lee Eric)
Message: 7
Date: Wed, 15 Jun 2011 19:17:36 +0800
From: Lee Eric <openlinuxsource at gmail.com>
To: For discussion of Syslinux and tftp-hpa <syslinux at zytor.com>
Cc: Wen Wei Tang <tangww at cn.ibm.com>, Xiao Dong Zhao
<zhaoxd at cn.ibm.com>, Shu Hua SH Chen <cshchen at cn.ibm.com>
Subject: Re: [syslinux] error when booting
Message-ID:
2010 Jul 05
1
export VTK from R : impossible to write data as float
Hello,
I've written a short code (below) to write 3D unstructured grid to binary
VTK files from R. Problem : I can only write integers with the command :
data<-as.numeric(c(3.3))
storage.mode(data)<-'integer'
writeBin(data,bfile_celldata,endian="swap")
the function storage.mode(data)<-'long' looks fine, but the VTK file is not
readable.
thanks for any
2006 Jun 02
1
Typo fix for readBin.Rd
Hi,
The man page for readBin has a small typo:
--- a/src/library/base/man/readBin.Rd
+++ b/src/library/base/man/readBin.Rd
@@ -58,7 +58,7 @@ writeBin(object, con, size = NA, endian
\code{readBin} and \code{writeBin} read and write C-style
zero-terminated character strings. Input strings are limited to 10000
- characters. \code{\link{readChar}} and \code{\code{writeChar}}
+
2002 Mar 13
1
R matrix to Python
I'm trying to export an R (1.4.0 on linux) matrix to python
(+Pyclimate) via a binary file. The problem is
that while R writes by columns, python reads
by rows. For a 2D matrix, there is no problem:
writeBin writes vectors, so
writeBin(t(x)[1:length(x)],...) works fine.
But the objects I want to export are 3D arrays
(slice rasters of lat,lon for each time t).
One way is to use a loop over
2024 May 21
1
wrtiteBin in conjunction with seek : the position in the file is not good when writing
Dear RHelp-list,
?I want to write at a specific position in a file without reading all
the file
because it is very large and I cannot read it in my RAM. But I miss
something
about the use of the command writeBin in conjunction with seek. In the
example bellow the seek
commands works well with the readBin command but not with writeBin, the
writeBin
command write from the beginning of the file
2017 Jul 15
2
readLines without skipNul=TRUE causes crash
On 15/07/2017 11:33 AM, Anthony Damico wrote:
> hi, i realized that the segfault happens on the text file in a new R
> session. so, creating the segfault-generating text file requires a
> contributed package, but prompting the actual segfault does not --
> pretty sure that means this is a base R bug? submitted here:
> https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17311