Displaying 20 results from an estimated 200 matches similar to: "R gets slow"
2006 Feb 05
2
R socket communication
Hello, I tried to code a R socket server but I did not succeed.
The problem is that once the R socket server is created,
I call the readLines function and then R gets blocked.
The client seems to work fine since I tested it with a PERL server.
I tried many combination of params in the socketConnection but
none of them worked.
I have seen some examples where the server sends something to a
client
2014 Jun 19
1
isOpen() misbehaviour
Hello,
>From the doc, it says:
"isOpen returns a logical value, whether the connection is currently open."
But actually it seems to die on closed connections:
> con <- file()
> isOpen(con)
[1] TRUE
> close(con)
> isOpen(con)
Error in isOpen(con) : invalid connection
Is it expected ?
Tested on R-3.0.2 and R version 3.1.0 Patched (2014-06-11 r65921) on
linux x86_64
2009 May 21
3
file descriptor leak in getSrcLines in R 2.10.0 svn 48590
I noticed the following file descriptor leak when I couldn't remove
a package unless I shut down the R session that had loaded and
used it. The function that triggered the problem printed the output
of a call to parse(). Each time one prints a srcref a connection is
opened and not closed. It looks like it happens in
as.character.srcref's
call to getSrcLines, which has some logic I
2002 Aug 06
0
Getting a GUI to work with Vorbis code
I am trying to create a Graphical User Interface for a Vorbis Player under
MS Visual C++ 6.0
I was initially trting to use the code from decoder_example.c but I keep
getting linker errors.
I have set up my project as told to by James Boer on this mailing list.
This is as follows:
This document was prepared from an email received from James Boer on the Ogg
Vorbis mailing list. It gives a
2007 Nov 14
1
isOpen on closed connections
As far as I can tell, 'isOpen' cannot return FALSE in the case when 'rw = ""'.
If the connection has already been closed by 'close' or some other function,
then isOpen will produce an error. The problem is that when isOpen calls
'getConnection', the connection cannot be found and 'getConnection' produces an
error. The check to see if it is
2009 Jul 21
1
Checking on closed file connections
Hi! I'm wondering if there's a smart way around this:
fileName= (some valid file on your system)
> fileCon=file(fileName, open="rt")
> l<-readLines (fileCon, n= 1)
>
> isOpen(fileCon)
[1] TRUE
> close(fileCon)
> isOpen(fileCon)
Error in isOpen(fileCon) : invalid connection
How do you test for a file being closed if isOpen gives you an error
2011 Apr 08
1
Invalid connection after closing?
Dear all,
I do not completely understand following behaviour :
> con <- file("test.txt")
> isOpen(con)
[1] FALSE
> open(con)
> isOpen(con)
[1] TRUE
> close(con)
> isOpen(con)
Error in isOpen(con) : invalid connection
> str(con)
Classes 'file', 'connection' atomic [1:1] 3
..- attr(*, "conn_id")=<externalptr>
Why do I get an
2000 Dec 20
1
unlink() is not synchronized with existing connections (PR#783)
> # creating a file
> cat("sddfasdf", file="tempfile")
> showConnections()
class description mode text isopen can read can write
> con <- file("tempfile", "r")
> readLines(con)
[1] "sddfasdf"
Warning message:
incomplete final line in: readLines(con, n, ok)
> showConnections()
class description mode text isopen
2018 Oct 31
1
PATCH: Asserting that 'connection' used has not changed + R_GetConnection2()
SUMMARY:
I'm proposing that R assert that 'connection' options have not changed
since first created such that R will produce the following error:
> fh <- file("a.txt", open = "w+")
> cat("hello\n", file = fh)
> close(fh)
> fh2 <- file("b.txt", open = "w+")
> cat("world\n", file = fh2)
>
2005 Apr 14
2
documentation for 'open': some clarification?
I'm been doing more and more of file text parsing inside R instead of
coping with Perl. For that, I need open a file and read it line-by-line.
I found the documentation for 'open' isn't very clear.
Right now it has
,----[ *help(R)[open]* ]
| 'open' opens a connection. In general functions using connections
| will open them if they are not open, but then close them
2017 Dec 14
4
cannot destroy connection (?) created by readLines in a tryCatch
On Thu, Dec 14, 2017 at 7:56 PM, Gabriel Becker <gmbecker at ucdavis.edu> wrote:
> Gabor,
>
> You can grab the connection and destroy it via getConnection and then a
> standard close call.
Yeah, that's often a possible workaround, but since this connection
was opened by
readLines() internally, I don't necessarily know which one it is. E.g.
I might open multiple
2006 Oct 09
1
Discussion starter for package level Connection API
Thought I'd try and start a discussion. Feel free to jump in.
I guess R needs to strike the right balance between opening up the
internals to package writers and not allowing them to do bad things. My
first attempt at cracking this nut is to just memcpy() the Rconnection
and not allow access to the private stuff:
/* Alternative to allowing C code access to connection API. */
Rconnection
2016 Nov 13
1
Memory leak with tons of closed connections
Using dup() before fdopen() (and calling fclose() on the connection
when it is closed) indeed fixes the memory leak.
FYI,
Gabor
Index: src/main/connections.c
===================================================================
--- src/main/connections.c (revision 71653)
+++ src/main/connections.c (working copy)
@@ -576,7 +576,7 @@
fp = R_fopen(name, con->mode);
} else { /* use
2005 Feb 01
2
assign connections automatically
Hi all,
I am trying to create a function that will open connections to all
files of
one type within the working directory.
I've got the function to open the connections, but I am having a
bugger of a
time trying to get these connections named as objects in the workspace.
I am at the point where I can do it outside of the function, but not
inside, using assign. I'm sure I'm
2017 Dec 14
2
cannot destroy connection (?) created by readLines in a tryCatch
Consider this code. This is R 3.4.2, but based on a quick look at the
NEWS, this has not been fixed.
tryCatch(
readLines(tempfile(), warn = FALSE)[1],
error = function(e) NA,
warning = function(w) NA
)
rm(list=ls(all.names = TRUE))
gc()
showConnections(all = TRUE)
If you run it, you'll get a connection you cannot close(), i.e. the
last showConnections() call prints:
?
2017 Dec 15
1
cannot destroy connection (?) created by readLines in a tryCatch
Thanks for tracking this down. Yeah, I should use suppressWarnings(),
you are right.
Although, readLines() might throw another warning, e.g. for incomplete
last lines,
and you don't necessarily want to suppress that.
TBH I am not sure why that warning is given:
? con <- file(tempfile())
? open(con)
Error in open.connection(con) : cannot open the connection
In addition: Warning message:
In
2013 Jun 19
2
Ryacas loads but yacas has an error
Hello yet again, R People:
I was working with Ryacas and yacas last night and all was well.
Now this morning, I keep getting the following:
> a <- Sym("a")
> a
Error in summary.connection(x) : invalid connection
>
When I go to yacas from the command line, it works fine.
Any suggestions, please?
I'm thinking that a port might be open, but here I have:
>
2006 Mar 27
5
How to create a directoy with R
Hello, I am trying to create directories with R. I would like R to
create directories because it is platform independent. I tried using
file() and searching in "R Data Import/Export" but I did not succeed.
I think it must be some function since exists the unlink to remove
directories (and files).
Pau
2007 Jul 03
1
bug in closing gzfile-opened connections?
Hi,
I am making multiple calls to gzfile() via read.table(), e.g.
> x <- read.table( gzfile( "xxx.gz" ) )
After i do this many times (I haven't counted, but probably between 50 and
100 times) I get the error message:
Error in open.connection(file, "r") : unable to open connection
In addition: Warning message:
cannot open compressed file 'xxx.gz'
however, I
2014 Mar 14
1
Detect a terminated pipe
Hi
Is there a way to detect that the process that corresponds to a pipe has
ended? On my system (Ubuntu 13.04), I see
> p <- pipe("true", "w"); Sys.sleep(1); system("ps -elf | grep true |
grep -v grep"); isOpen(p)
[1] TRUE
The "true" process has long ended (as the filtered ps system call emits
no output), still R believes that the pipe p is