Displaying 20 results from an estimated 11000 matches similar to: "Too many open files"
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
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:
?
2007 Dec 27
0
Too many open files
Dear all,
Did this problem that was posted in 2006 (see below) ever got fully resolved
?
I am encountering the exact same issue
; I have executed get.hist.quote() in a loop and now R not only refuses to
establish any further connections to yahoo, but, worse, it will not open any
files either. For example, I cannot even save my current workspace for that
reason.
I tried
closeAllConnections()
As
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 15
2
how many 7th of the month is there between two dates
This is a eaeir way to ask my prior question:
I want to caculate how many an exact day of the month there is between
two dates.
For example; How many 7th of the month is there between "1998/12/17"
and "2000/1/7". To make the problem simple, the day of the month (7)
is the day in the 2nd date.
2005 Oct 27
3
its dates masked by chron
I built R 2.2.0 from source on my debian machine yesterday and updated
all packages. My problem is that "dates" function from its, that my
code heavely uses is now masked by "dates" from chron.
How can I specify tehat I want to use dates from its or how can I
prevent it from being masked?
> library(its)
Loading required package: Hmisc
Hmisc library by Frank E Harrell Jr
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
2006 Apr 10
3
timeAlign
I use POSIXct for datetimes. Is thee a timeAlign function that I can
use where :
align by year
direction -1 ==> start of this year
direction 1 ==> start of next year
align by week
direction -1 ==> date on last sunday
direction 1 ==> date on next sunday
align by day
direction -1 ==> time at past midnight
direction 1 ==> time at this comming
2005 May 13
2
without the loop
Can this be re-implemented to run faster (without the loop) ?
r <- list()
n = nrow(prices)
for (i in (w+1):n) {
window <- prices[(i-w):(i-1),]
if (prices[i,]$settle > max(window$high)) r <-
append(r, 1)
else if (prices[i,]$settle < min(window$low)) r <-
append(r, -1)
2005 Jun 24
2
seq in R
I want to generate a sequence from 1 to x by 1
seq(1,x,by=1)
I want the above to return an empty list if x is zero
In other languages I can do 1:x:1 to force the increment by to be a
positive 1. This syntax does not work in R. In R 1:x gives me
1 0
when x is zero, this is not what I want.
The seq statement above throws an error when x is 0.
How can I generate a sequence where if the
2005 Jun 07
3
without a loop
tmp <- c(-1,NA,NA,1,1,NA,NA,1)
without using a loop, how can I replace all NAs in the list above with
the previous none NA value in the list?
2005 May 25
5
precision problem
I have prices that I am finding difficult to compare with ==, > and >,
due to precision. For example: the numbers should match, with '==',
but they differ in the magnitude of 1e-14 due to bunch of calculations
that I run on them. Programming with java, I am used to implementing a
function that compares the difference between the numbers to a pre
determined precision factor. This
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 28
2
how to construct an empty data.frame
> r
[1] open settle
<0 rows> (or 0-length row.names)
> class(r)
[1] "data.frame"
this is an empty data.frame I get back from a sql statement that
returns an empty result set. How can I create such an empty data.frame
using the data.frame() constructor?
I want to have a data.frame with 0 rows but named empty columns.
Thanks in advance for any help.
2005 Oct 06
2
isdst
Can someone, please, explain the difference is results below (notice
the isdst value)
> unlist(as.POSIXlt('2005-7-1'))
sec min hour mday mon year wday yday isdst
0 0 0 1 6 105 5 181 1
> unlist(as.POSIXlt(as.Date('2005-7-1')))
sec min hour mday mon year wday yday isdst
0 0 0 1 6 105 5 181 0
2006 Apr 10
2
seq
Can someone, please, help explain to me why the following two calls
return the same set:
> seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-2'), by='weeks')
[1] "2005-12-04 EST" "2005-12-11 EST" "2005-12-18 EST" "2005-12-25 EST"
[5] "2006-01-01 EST" "2006-01-08 EST" "2006-01-15 EST"
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
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
2005 May 13
1
where is aggregateSeries
What package is aggregateSeries in?
It is referred to in the fCalendar document but I do not see it in the package.
2005 May 18
1
align
Is there a function in R that is similar to Splus's align?
The idea is, if I have a data.frame, or an its object that is like this:
2002-01-03 5
2002-01-04 NA
2002-01-05 7
2002-01-06 NA
I want to align it by the last value to this:
2002-01-03 5
2002-01-04 5
2002-01-05 7
2002-01-06 7
TITLE:
Function align
USAGE:
align(x, pos, how, error.how, localzone,