Displaying 20 results from an estimated 1000 matches similar to: "file descriptor leak in getSrcLines in R 2.10.0 svn 48590"
2009 Oct 30
1
.Rprofile replacement function setwd() causing errors
In my .Rprofile I have the following functions which display the
current directory in the main R window title bar,
and modify base::setwd() to keep this up to date. I like this because I
can always tell where I am in the file system.
cd <- function(dir) {
base::setwd(dir)
utils::setWindowTitle( short.path(base::getwd()) )
}
short.path <- function(dir, len=2) {
np
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 Nov 02
3
CRAN task views work only once per session (PR#9330)
Cran task views seems to be a "once-per-session" process -- the first
attempt to access views in a (RGui for Windows) session works, but
subsequent attempts fail. There is a noticeably long pause before
the failing call returns.
Example session with two calls to "available.views" follows, but similar
effects have been observed with two calls to "install.views" and
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:
?
2006 Mar 25
2
R gets slow
Hello, I have R as a socket server that computes R code sent by some
scripts (the clients). These scrips send R code to generate models
(SVM). The problem is that first models are generated in less than one
second and one hour later, the same models are generated in more than
ten seconds (even training with same data). If I restart the server ,
then it works well (fast). I don't know if I have
2006 May 26
2
Too many open files
This may be more of an OS question ...
I have this call
r = get.hist.quote(symbol, start= format(start, "%Y-%m-%d"), end=
format(end, "%Y-%m-%d"))
which does a url request
in a loop and my program runs out of file handlers after few hundred
rotations. The error message is: 'Too many open files'. Other than
increasing the file handlers assigned to my process, is there
2009 Feb 12
1
Why is srcref of length 6 and not 4 ?
Hello,
Consider this file (/tmp/test.R) :
<file>
f <- function( x, y = 2 ){
z <- x + y
print( z )
}
</file>
I get this in R 2.7.2 :
> p <- parse( "/tmp/test.R" )
> str( attr( p, "srcref" ) )
List of 1
$ :Class 'srcref' atomic [1:4] 1 1 4 1
.. ..- attr(*, "srcfile")=Class 'srcfile' length 4 <environment>
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
2006 Nov 25
2
Source references from the parser
I have just committed some changes to R-devel (which will become R 2.5.0
next spring) to add source references to parsed R code. Here's a
description of the scheme:
The design is done through 2 old-style classes.
"srcfile" corresponds to a source file: it contains a filename, the
working directory in which that filename is to be interpreted, the last
modified timestamp of the
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
2010 Feb 11
1
Find Source File Corresponding to Sourced Function
I've noticed that when you debug a function that was loaded into the
workspace using the source function, it prints the location of the
file from which the function was sourced. Is there a way to get that
same information without debugging the function?
Thanks,
Scott
2013 Dec 13
1
Proper way to drop 'srcref' from an expression created via substitute(function() ...)?
First, why does this expression have a 'srcref' element:
> exprA <- substitute(function(x) a*x, list(a=2))
> print(exprA)
function(x) 2 * x
> str(as.list(exprA))
List of 4
$ : symbol function
$ :Dotted pair list of 1
..$ x: symbol
$ : language 2 * x
$ :Class 'srcref' atomic [1:8] 1 20 1 34 20 34 1 1
.. ..- attr(*, "srcfile")=Classes
2016 May 20
2
identical on closures
Specifically, the srcfile attribute of the srcref attribute of the two
instances of the functions contain different environments, AFAICT.
Environments are compared only by exact pointer, so this forces return
FALSE.
Snippets from .Internal(inspect(x)) and .Internal(inspect(y)):
@cca008 03 CLOSXP g0c0 [MARK,NAM(2),ATT]
FORMALS:
@604b58 00 NILSXP g0c0 [MARK,NAM(2)]
BODY:
@cc9650 06 LANGSXP
2016 Mar 13
1
formals(x)<- drops attributes including class
Just checking in to see whether it is intended or not that assigning
new formals to a function/closure causes any attributes to be dropped:
EXAMPLE:
> fcn <- structure(function() {}, foo="foo", class=c("foo"))
> str(fcn)
function ()
- attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 18 1 30 18 30 1 1
.. ..- attr(*, "srcfile")=Classes
2016 May 20
2
identical on closures
I'm confused by this:
> identical(function() {}, function() {})
[1] FALSE
Yet, after loading the Matrix package (which redefines det), the
following is checked (in library.checkConflicts):
> identical(get("det", baseenv()), get("det", asNamespace("Matrix")),
ignore.environment=T)
[1] TRUE
I've looked at the code in identical.c and for closures it
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:
>
2014 Mar 05
1
[PATCH] Code coverage support proof of concept
Hello,
I submit a patch for review that implements code coverage tracing in
the R interpreter.
It records the lines that are actually executed and their associated
frequency for which srcref information is available.
I perfectly understands that this patch will not make its way inside R
as it is, that they are many concerns of stability, compatibility,
maintenance and so on.
I would like to have
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
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
2023 Mar 30
1
removeSource() vs. function literals
Dear R-devel,
In a package of mine, I use removeSource on expression objects in order
to make expressions that are semantically the same serialize to the
same byte sequences:
https://github.com/cran/depcache/blob/854d68a/R/fixup.R#L8-L34
Today I learned that expressions containing function definitions also
contain the source references for the functions, not as an attribute,
but as a separate