Displaying 20 results from an estimated 81 matches for "rboolean".
Did you mean:
boolean
2013 May 24
1
Problem with Rboolean in c++ code
I am trying to use R_RegisterCFinalizerEx to ensure some c++ object is
properly deleted after use. However, I run into some problems when
trying to pass in the third argument which is an Rboolean. The line
'R_RegisterCFinalizerEx(p, finalizer, TRUE);' generates the following
error when trying to compile using R CMD SHLIB:
g++ -I/usr/share/R/include -DNDEBUG -fpic -O2 -pipe -g -c
rboolean.cpp -o rboolean.o
rboolean.cpp: In function ?SEXPREC* create(SEXP)?:
rboolean.cpp...
2011 Feb 11
1
Writting my own package - 64 bit problem with R_GetCCallable
...ation of
function ?R_GetCCallable?
slim_stolen_from_matrix.c:36: warning: cast to pointer from integer of
different size
--------------
The function in question is an identical copy of Matrix's
M_as_cholmod_sparse, reproduced below
--------------
CHM_SP
R_as_cholmod_sparse(CHM_SP ans, SEXP x, Rboolean check_Udiag, Rboolean
sort_in_place)
{
static CHM_SP(*fun)(CHM_SP,SEXP,Rboolean,Rboolean)= NULL;
if(fun == NULL)
fun = (CHM_SP(*)(CHM_SP,SEXP,Rboolean,Rboolean))
R_GetCCallable("Matrix", "as_cholmod_sparse");
return fun(ans, x, check_Udiag, sort_in_place);
}
--...
2010 Aug 23
1
Speeding up sum and prod
...gest reason for the improvement is that the current code (in
2.11.1 and in the development release of 2010-08-19) makes a costly
call of ISNAN even when the option is na.rm=FALSE. The inner loop
can also be sped up a bit in other respects.
Here is the old procedure, in src/main/summary.c:
static Rboolean rsum(double *x, int n, double *value, Rboolean narm)
{
LDOUBLE s = 0.0;
int i;
Rboolean updated = FALSE;
for (i = 0; i < n; i++) {
if (!ISNAN(x[i]) || !narm) {
if(!updated) updated = TRUE;
s += x[i];
}
}
*value = s;
return(upd...
2009 Jan 19
1
patch for textspecial and defaultfont in xfig
...====================================================
--- src/library/grDevices/src/devPS.c (revision 47637)
+++ src/library/grDevices/src/devPS.c (working copy)
@@ -4354,6 +4354,9 @@
int ymax; /* used to invert coord system */
char encoding[50]; /* for writing text */
+ Rboolean textspecial; /* use textspecial flag in xfig for latex
integration */
+ Rboolean defaultfont; /* use the default font in xfig */
+
/*
* Fonts and encodings used on the device
*
@@ -4553,6 +4556,7 @@
double width, double height,
Rboolean horizontal, double ps,...
2007 May 30
5
Possible changes to connections
When I originally implemented connections in R 1.2.0, I followed the model
in the 'Green Book' closely. There were a number of features that forced
a particular implementation, and one was getConnection() that allows one
to recreate a connection object from a number.
I am wondering if anyone makes use of this, and if so for what?
It would seem closer to the R philosophy to have
2018 May 08
2
unlist errors on a nested list of empty lists
...> should have been false, and then the result would have been
>
> .Internal(unlist(x, recursive, use.names))
>
> (with both recursive and use.names being TRUE), which returns NULL.
And the problem is in the islistfactor function in src/main/apply.c,
which looks like this:
static Rboolean islistfactor(SEXP X)
{
int i, n = length(X);
switch(TYPEOF(X)) {
case VECSXP:
case EXPRSXP:
if(n == 0) return NA_LOGICAL;
for(i = 0; i < LENGTH(X); i++)
if(!islistfactor(VECTOR_ELT(X, i))) return FALSE;
return TRUE;
break;...
2005 Jul 20
1
(PR#8017) build of REventLoop package crashes with 2.1 due
...t; dir */
> < extern char R_StdinEnc[31] INI_as(""); /* Encoding assumed for stdin
> */
> ---
>> extern char* R_TempDir INI_as(NULL); /* Name of per-session dir */
> 530d528
> < extern void R_setupHistory();
> 541,542c539
> < LibExtern Rboolean utf8locale INI_as(FALSE); /* is this a UTF-8 locale? */
> < LibExtern Rboolean mbcslocale INI_as(FALSE); /* is this a MBCS locale? */
> ---
>> extern Rboolean utf8locale INI_as(FALSE); /* is this a UTF-8 locale? */
> 596a594
>> # define duplicated Rf_duplicat...
2005 Apr 02
2
Building new graphic device drivers with g++
...=====================================================
======================
#include <R.h>
#include <Rinternals.h>
#include <Rgraphics.h>
#include <Rdevices.h>
#include <R_ext/GraphicsDevice.h>
#include <R_ext/GraphicsEngine.h>
extern "C" {
static Rboolean nullDeviceDriver(NewDevDesc *dev);
SEXP do_devNULL() {
NewDevDesc *dev = NULL;
GEDevDesc *dd;
R_CheckDeviceAvailable();
if (!(dev = (NewDevDesc *) calloc(1, sizeof(NewDevDesc))))
return R_NilValue;
dev->displayList = R_NilValue;
if (!nullDeviceDriver(dev)) {...
2005 Jul 19
0
build of REventLoop package crashes with 2.1 due tosyntax error in Defn.h (PR#8017)
...INI_as(NULL); /* Name of per-session
dir */
< extern char R_StdinEnc[31] INI_as(""); /* Encoding assumed for stdin
*/
---
> extern char* R_TempDir INI_as(NULL); /* Name of per-session dir */
530d528
< extern void R_setupHistory();
541,542c539
< LibExtern Rboolean utf8locale INI_as(FALSE); /* is this a UTF-8 locale? */
< LibExtern Rboolean mbcslocale INI_as(FALSE); /* is this a MBCS locale? */
---
> extern Rboolean utf8locale INI_as(FALSE); /* is this a UTF-8 locale? */
596a594
> # define duplicated Rf_duplicated
633c631
< # defin...
2010 Oct 01
0
ff version 2.2.0
...inplace operations receiving enough RAM to optimize for speed, not for memory
ff: new on-disk operations limiting RAM for this operation at ~500GB
R: timings from standard sort() and order()
SAS: timings from SAS 9.2 allowing for multithreaded sorting
Legend for type of random data
rboolean: bi-boolean with 50% FALSE and TRUE
rlogical: tri-boolean with 33% NA, FALSE and TRUE
rubyte: integers from 0..255
rbyte: 33% NA and 67% -127..127
rushort: integers from 0..65535
rshort: 33% NA and 67% -32767..32767
ruinteger: 50% NA and 50% integers
rinteger: random in...
2010 Oct 01
0
ff version 2.2.0
...inplace operations receiving enough RAM to optimize for speed, not for memory
ff: new on-disk operations limiting RAM for this operation at ~500GB
R: timings from standard sort() and order()
SAS: timings from SAS 9.2 allowing for multithreaded sorting
Legend for type of random data
rboolean: bi-boolean with 50% FALSE and TRUE
rlogical: tri-boolean with 33% NA, FALSE and TRUE
rubyte: integers from 0..255
rbyte: 33% NA and 67% -127..127
rushort: integers from 0..65535
rshort: 33% NA and 67% -32767..32767
ruinteger: 50% NA and 50% integers
rinteger: random in...
2005 Mar 15
2
syntax error in memory.c when building R-devel on AIX
...any problems. I
used the settings in the Appendix B of R-admin, using the set of variables
that Tim Hoar used (i.e., trying to build 64-bit R using native compilers).
configure ran fine, but `gmake' gave me a syntax error when compiling
src/main/memory.c. The offending line seems to be:
Rboolean success = FALSE;
Can anyone provide pointers?
(Just to make sure, I tried building it on our SLES9-x86_64 box, and that
passes make check.)
TIA!
Andy
2019 May 19
4
most robust way to call R API functions from a secondary thread
...d() using e.g. R_alloc().
Best regards,
Andreas Kersting
#include <Rinternals.h>
#include <pthread.h>
#include <signal.h>
#include <stdint.h>
extern uintptr_t R_CStackLimit;
extern int R_PPStackTop;
extern int R_PPStackSize;
#include <R_ext/libextern.h>
LibExtern Rboolean R_interrupts_suspended;
LibExtern int R_interrupts_pending;
extern void Rf_onintr(void);
// mutex for exclusive access to the R API:
static pthread_mutex_t r_api_mutex = PTHREAD_MUTEX_INITIALIZER;
// a wrapper arround R_CheckUserInterrupt() which can be passed to R_UnwindProtect():
SEXP check_int...
2018 May 09
2
unlist errors on a nested list of empty lists
...>
> > .Internal(unlist(x, recursive, use.names))
> >
> > (with both recursive and use.names being TRUE), which returns NULL.
>
> And the problem is in the islistfactor function in src/main/apply.c,
> which looks like this:
>
> static Rboolean islistfactor(SEXP X)
> {
> ? ? ?int i, n = length(X);
>
> ? ? ?switch(TYPEOF(X)) {
> ? ? ?case VECSXP:
> ? ? ?case EXPRSXP:
> ? ? ? ? ?if(n == 0) return NA_LOGICAL;
> ? ? ? ? ?for(i = 0; i < LENGTH(X); i++)
> ? ? ? ? ? ? ?if(!isl...
2019 May 01
3
anyNA() performance on vectors of POSIXct
...YPEOF(x) ITERATE_BY_REGION calls?
# script to demonstrate performance difference if x is an OBJECT or not by
using unclass()
x.posixct = Sys.time() + 1:1e6
microbenchmark::microbenchmark(
any(is.na( x.posixct )),
anyNA( x.posixct ),
anyNA( unclass(x.posixct) ),
unit='ms')
static Rboolean anyNA(SEXP call, SEXP op, SEXP args, SEXP env)
{
SEXP x = CAR(args);
SEXPTYPE xT = TYPEOF(x);
Rboolean isList = (xT == VECSXP || xT == LISTSXP), recursive = FALSE;
if (isList && length(args) > 1) recursive = asLogical(CADR(args));
*if (OBJECT(x) || (isList && !recursi...
2010 Jun 19
1
more powerful iconv
....Internal(iconv(x, from, to, as.character(sub), mark))
}
Index: src/main/sysutils.c
===================================================================
--- src/main/sysutils.c (revision 52328)
+++ src/main/sysutils.c (working copy)
@@ -548,16 +548,17 @@
int mark;
const char *from, *to;
Rboolean isLatin1 = FALSE, isUTF8 = FALSE;
+ Rboolean isRawx = (TYPEOF(x) == RAWSXP);
- if(TYPEOF(x) != STRSXP)
- error(_("'x' must be a character vector"));
+ if(TYPEOF(x) != STRSXP && !isRawx)
+ error(_("'x' must be a character vector or raw"));
if(!...
2015 Jun 01
2
sum(..., na.rm=FALSE): Summing over NA_real_ values much more expensive than non-NAs for na.rm=FALSE? Hmm...
...stopifnot(typeof(z) == "double")
> system.time(sum(z, na.rm=FALSE))
user system elapsed
4.49 0.00 4.51
Following the source code, I'm pretty sure the code
(https://github.com/wch/r-source/blob/trunk/src/main/summary.c#L112-L128)
performing the calculation is:
static Rboolean rsum(double *x, R_xlen_t n, double *value, Rboolean narm)
{
LDOUBLE s = 0.0;
Rboolean updated = FALSE;
for (R_xlen_t i = 0; i < n; i++) {
if (!narm || !ISNAN(x[i])) {
if(!updated) updated = TRUE;
s += x[i];
}
}
if(s > DBL_MAX) *value = R_PosInf;
else if (s &l...
2017 Jan 25
2
parallel::mc*: Is it possible for a child process to know it is a fork?
When using multicore-forking of the parallel package, is it possible
for a child process to know that it is a fork? Something like:
parallel::mclapply(1:10, FUN = function(i) { test_if_running_in_a_fork() })
I'm looking into ways to protect against further parallel processes
(including threads), which not necessarily are created via the
parallel:mc* API, are being spawned off recursively.
2008 Jan 26
2
scatterplot3d with categorical data
Dear users,
I'm trying to produce a 3d bar plot but the x and y dimensions have categorical
data -- so I only want 3 points on each axis. So I try:
require(scatterplot3d)
mymat<-data.frame(
x=c(1,1,1,2,2,2,3,3,3),
y=c(1,2,3,1,2,3,1,2,3),
z=c(1,2,3,4,5,6,7,8,9))
scatterplot3d(mymat,
type="h", lwd=5, pch=" ",
xlab="xlabel",
2007 Jan 18
0
Emulating a REPL in frontends
...API. If there is a concern that the
details of this function may change, a wrapper like the following should be
good enough for most, if not all frontend purposes:
void Rf_parseErrorDefault()
{
parseError(R_NilValue, 0);
}
2) Add a simple function to do auto-printing to the public API. E.g.:
Rboolean Rf_doAutoPrint(SEXP exp)
{
if(R_Visible) {
printValueEnv(exp, R_GlobalEnv);
return TRUE; /* was printed */
}
return FALSE;
}
Another suggestion, which might well be seen as adding too many constraints on
future development, but provided for completeness: A more generic version of
t...