Displaying 20 results from an estimated 10000 matches similar to: "Base R examples that write to current working directory"
2018 Mar 30
2
Base R examples that write to current working directory
On 30.03.2018 00:08, Duncan Murdoch wrote:
> On 29/03/2018 5:23 PM, Hadley Wickham wrote:
>> Hi all,
>>
>> Given the recent CRAN push to prevent examples writing to the working
>> directory, is there any interest in fixing base R examples that write
>> to the working directory? A few candidates are the graphics devices,
>> file.create(), writeBin(),
2018 Apr 03
2
Base R examples that write to current working directory
>>>>> Henrik Bengtsson <henrik.bengtsson at gmail.com>
>>>>> on Fri, 30 Mar 2018 10:14:04 -0700 writes:
> So, the proposal would then be to write to tempdir(),
> correct? If so, I see three alternatives:
> 1. explicitly use file.path(tempdir(), filename), or
> tempfile() everywhere.
I think it should clearly be '1.',
2018 Apr 04
0
Base R examples that write to current working directory
Martin et al,
I have submitted a patch on bugzilla which fixes all of the examples I
could easily find which were not already writing only to temporary files or
switching to a temp directory before writing files to the working
directory. https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17403
Passes make check-devel so the examples run and the packages that were
modified pass check.
Best,
~G
2018 Mar 30
0
Base R examples that write to current working directory
So, the proposal would then be to write to tempdir(), correct? If so,
I see three alternatives:
1. explicitly use file.path(tempdir(), filename), or tempfile() everywhere.
2. wrap example code in a withTempDir({ ... }) call.
3. Add an 'eval.path' (*) argument to example() and make it default to
eval.path = tempdir(). This would probably be backward compatible and
keep the code example
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
2006 Aug 29
1
writeChar
I have recently been using writeChar and writeBin to write binary
files. These functions makes it very easy to write OS-independent
files, which I am very happy with.
I have however found a few issues, best illustrated by a short example
> con <- file("test", open = "wb")
> writeChar(as.character(c("ab", "ab")), nchars = c(3), con = con,
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}}
+
2008 Oct 28
2
writting null (\000 or ^@) to an external text file without the new warning
I have some functions that write an external text file for postprocessing by another program. Some instructions to the other program need to be indicated by null values (\000 or ^@). The function currently uses code like:
writeChar(rawToChar(as.raw(0)), con)
where con is a connection to the file. Previous to version 2.8.0 this worked fine. With 2.8.0 it still works, but I get a warning
2006 Mar 30
1
Writing character vectors with embedded nulls to a connection
Is this possible? I've tried both writeChar() and writeBin() to no avail.
My goal is to serialize(ascii=FALSE) an object to a connection but
determine the size of the serialized object before hand:
sobject <- serialize(object,NULL,ascii=FALSE)
len <- nchar(sobject)
#
# run some code here to notify listener on other end of connection
# how many bytes I'm getting ready to send
#
2003 Nov 14
2
writeChar potential buffer overrun (PR#5090)
Trying to copy the (binary) header of a input file directly
to an output file, I've had repeatable seg faults. The call:
writeChar(hdr, outfh, nchars=6144)
when hdr just contains one empty string seems to be the
culprit. The stack traces weren't all that illuminating,
with sig 11 in memory-related functions following this. But
in src/main/connections.c it looks like do_writechar
2002 Jun 18
3
Maybe a problem in binary read/write (PR#1688)
Full_Name: Johnny Accot
Version: 1.5.1
OS: Linux
Submission from: (NULL) (198.4.83.52)
Hi.
I'm having a problem with the binary read/write functions. I'm writing a device
driver in R (why not?) and of course I have to send a couple commands to the
device. Typically, I send one byte, receive one acknowledgement byte, send
another byte, receive an ACK, and so on. At least this is what
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",
2018 Jan 10
2
R CMD build then check fails on R-devel due to serialization version
Hi,
Since yesterday I'm seeing `R CMD check --as-cran` failures on the
R-devel daily build (specifically, R Under development (unstable)
(2018-01-09 r74100)) for multiple packages:
* checking serialized R objects in the sources ... WARNING
Found file(s) with version 3 serialization:
?build/vignette.rds?
Such files are only readable in R >= 3.5.0.
Recreate them with R < 3.5.0 or
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
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.
2020 Oct 29
2
[External] Something is wrong with the unserialize function
This
Index: src/main/altrep.c
===================================================================
--- src/main/altrep.c (revision 79385)
+++ src/main/altrep.c (working copy)
@@ -275,10 +275,11 @@
SEXP psym = ALTREP_SERIALIZED_CLASS_PKGSYM(info);
SEXP class = LookupClass(csym, psym);
if (class == NULL) {
- SEXP pname = ScalarString(PRINTNAME(psym));
+ SEXP pname =
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 <-
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"