Displaying 20 results from an estimated 7000 matches similar to: "clean-up actions after non-local exits"
2004 Jun 14
5
mkChar can be interrupted
Hi,
As was discussed earlier in another thread and as documented in R-exts
.Call() should not be interruptible by Ctrl-C. However the following
code, which spends most of its time inside mkChar, turned out to be
interruptible on RH-7.3 R-1.8.1 gcc-2.96:
#include <Rinternals.h>
#include <R.h>
SEXP foo0(const SEXP nSexp) {
int i, n;
SEXP resSexp;
if (!isInteger(nSexp))
2005 Apr 12
5
How allocate STRSXP outside of gc
Hi,
I am trying to figure a way to allocate a string SEXP so that gc() won't
ever collect it.
Here is a little bit of a background. Suppose I want to write a
.Call-callable function that upon each call returns the same value, say
mkChar("foo"):
SEXP getFoo() {
return mkChar("foo");
}
The above implementation doesn't take advantage of the fact that
2005 Apr 27
1
RE: [R] when can we expect Prof Tierney's compiled R?
Luke,
Thank you for sharing the benchmark results. The improvement is very
substantial, I am looking forward to the release of the byte compiler!
The arithmetic shows that x[i]<- is still the bottleneck. I suspect that
this is due to a very involved dispatching/search for the appropriate
function on the C level. There might be significant gain if loops
somehow cached the result of the initial
2004 Jun 08
5
fast mkChar
Hi,
To speed up reading of large (few million lines) CSV files I am writing
custom read functions (in C). By timing various approaches I figured out
that one of the bottlenecks in reading character fields is the mkChar()
function which on each call incurs a lot of garbage-collection-related
overhead.
I wonder if there is a "vectorized" version of mkChar, say mkChar2(char
**, int
2004 Jun 30
2
Slow IO: was [R] naive question
I believe IO in R is slow because of the way it is implemented, not
because it has to do some extra work for the user.
I compared scan() with 'what' argument set (which is, AFAIK, is the
fastest way to read a CSV file) to an equivalent C code. It turned out
to be 20 - 50 times slower.
I can see at least two main reasons why R's IO is so slow (I didn't
profile this though):
A) it
2005 Mar 16
3
Write Barrier: was: function-like macros undefined
Hi,
Thank you to Duncan Murdoch for pointing to
http://www.stat.uiowa.edu/~luke/R/barrier.html.
I have a couple of questions in this regard:
* suppose that inside a C function I have a SEXP vector x of integers
and I want to increment each element by one. I understand that
int * xIPtr = INTEGER(x);
int i;
for (i=0; i<LENGTH(x); ++i)
SET_VECTOR_ELT(x, i, xIPtr[i]+1);
is the
2005 Apr 22
1
RE: [R] when can we expect Prof Tierney's compiled R?
If we are on the subject of byte compilation, let me bring a couple of
examples which have been puzzling me for some time. I'd like to know a)
if the compilation will likely to improve the performance for this type
of computations, and b) at least roughly understand the reasons for the
observed numbers, specifically why x[i]<- assignment is so much slower
than x[i] extraction.
The loops
2005 Mar 22
1
documentation on seek *does not* need update
Well, "integer" is also a storage.mode in R. It is not immediately clear
which meaning the help page uses. I guess some extra elaboration would
be helpful.
Anyway, thank you for the clarification,
Vadim
> -----Original Message-----
> From: Prof Brian Ripley [mailto:ripley@stats.ox.ac.uk]
> Sent: Tuesday, March 22, 2005 9:54 AM
> To: Vadim Ogranovich
> Cc:
2004 Sep 24
1
algorithm reference for sample() - Knuth
Thank you for the reference to Knuth. Indeed in vol. 2 he has a
> -----Original Message-----
> From: Tony Plate [mailto:tplate@blackmesacapital.com]
> Sent: Friday, September 24, 2004 8:05 AM
> To: Vadim Ogranovich
> Subject: Re: [Rd] algorithm reference for sample()
>
> Have you tried looking in Knuth's books on computer
> algorithms? (They are classics for good
2005 May 04
1
Cost of method dispatching: was: when can we expect Prof Tierney's compiled R?
> -----Original Message-----
> From: Prof Brian Ripley [mailto:ripley@stats.ox.ac.uk]
> Sent: Wednesday, April 27, 2005 1:13 AM
> To: Vadim Ogranovich
> Cc: Luke Tierney; r-devel@stat.math.ethz.ch
> Subject: Re: [Rd] RE: [R] when can we expect Prof Tierney's
> compiled R?
>
> On Tue, 26 Apr 2005, Vadim Ogranovich wrote:
>
...
> > The arithmetic shows
2019 Apr 30
2
[External] Re: Background R session on Unix and SIGINT
Unfortunately --interactive also makes the session interactive(),
which is bad for me, as it is a background session.
In general, I don't want the interactive behavior, but was wondering
if I could send as SIGINT to try to interrupt the computation of the
background process, and if that does not work, then I would send a
SIGKILL and start up another process. It all works nicely, except for
2005 Mar 16
1
function-like macros undefined
Hi,
Somehow function-like macros from Rinternals.h are not defined when I
include the file.
foo.c
##################
#include <R.h>
#include <Rinternals.h>
#ifndef NILSXP
#error("NILSXP")
#endif
#ifndef INTEGER
#error("INTEGER")
#endif
###################
When compiled:
vor/src% gcc -I/usr/local/lib/R/include -g -O2 -c foo.c -o foo.o
foo.c:11:2: #error
2019 Aug 02
4
Infrequent but steady NULL-pointer caused segfault in as.POSIXlt.POSIXct (R 3.4.4)
The R script I run daily for hours looks like this:
while (!finish) {
Sys.sleep(0.1)
time = as.integer(format(Sys.time(), "%H%M")) # always crash here
if (new.data.timestamp() <= time)
next
# ... do some jobs for about 2 minutes ...
gc()
}
Basically it waits for new data, which comes in every 10 minutes, and
do some jobs, then gc(), then loop again. It
2016 Oct 31
1
BUG?: On Linux setTimeLimit() fails to propagate timeout error when it occurs (works on Windows)
On Mon, 31 Oct 2016, Henrik Bengtsson wrote:
> Thank you for looking into this Luke.
>
> On Thu, Oct 27, 2016 at 9:26 AM, <luke-tierney at uiowa.edu> wrote:
>> On unix, unless event polling is enabled Sys.sleep just waits in a
>> select() call (with a SIGINT handler in place) so the elapsed time
>> isn't checked until after the select call is complete.
2019 Aug 04
1
Infrequent but steady NULL-pointer caused segfault in as.POSIXlt.POSIXct (R 3.4.4)
A reply from stackoverflow suggests I might have hit this bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=14023
I can confirm that this glibc bug affects my system (latest CentOS 7).
However, as far as I know, R is not multithreaded in its core. Is it
possible that some library triggered this?
Regards,
Steve
Tomas Kalibera <tomas.kalibera at gmail.com> ?2019?8?2??? ??4:59???
>
2003 Sep 05
1
Problem with S4 slots in C code (PR#4073)
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C3738F.63DE3390
Content-Type: text/plain;
charset="iso-8859-1"
#I want to be able to create a new S4 class and read data into it using C
code
# Here is a very simple S4 object inheriting from "array", but with 5
2006 Nov 17
1
Manipulating R lists in C
Hi,
I have been studying the R manual on lists but cannot seem to create a
simple R list in C - I keep on getting "'dimnames' applied to non-array"
whenever I attempt to assign names to the list elements:
Wanted output a list structure something like
[ type="Bid", price=2.0, volume=1000 ]
I can get up to a list of
[ "Bid2, 2.0, 1000 ]
But for the life of
2008 Oct 28
2
A question about the API mkchar()
Hi guys,
I've got a question about the API mkchar(). I have met some difficulty
in parsing utf-8 string to mkchar() in R-2.7.0.
I was intending to parse an utf-8 string str_jan (some Japanese
characters such as?, whose utf-8 code is E381B5) to R API SEXP
mkChar(const char *name) , we only need to create the SEXP using the
string that we parsed.
Unfortunately, I found when parsing the
2013 Jun 27
3
Read a text file into R with .Call()
Hi,
I want to read a text file into R with .Call().
So I define some NEW_CHARACTER() to store the chracters read and use SET_STRING_ELT to fill the elements.
e.g.
PROTECT(qNames = NEW_CHARACTER(10000));
char *foo; // This foo holds the string I want.
while(foo = readLine(FN)){
SET_STRING_ELT(qNames, i, mkChar(foo)));
}
In this way, I can get the desired character from qNames. The only problem
2014 Jun 26
1
using 2D array of SEXP for creating dataframe
Hi ,
For our production package i need to create a dataframein C . So I wrote
the following code
SEXP dfm ,head,df , dfint , dfStr,lsnm;
*SEXP valueVector[2];*
char *ab[3] = {"aa","vv","gy"};
int sn[3] ={99,89,12};
char *listnames[2] = {"int","string"};
int i,j;
//=============================
PROTECT(df = allocVector(VECSXP,2));