Displaying 20 results from an estimated 27 matches for "sexptype".
2014 May 16
1
SEXPTYPEs
..."temp" should be a vector of length > 32-bit, and "p_temp" should be the
pointer to that vector.
If declaring:
long long int *p_temp;
(but the compiler throws a warning with an incompatible pointer type,
because pointers should be integers of course).
I've looked at all SEXPTYPEs in the R internals, and the only one specific
to integer vectors is INTSXP. Can this be used for vectors of length larger
than 32-bit?
Thank you again, in advance,
Adrian
--
Adrian Dusa
University of Bucharest
Romanian Social Data Archive
1, Schitu Magureanu Bd.
050025 Bucharest sector 5
Roman...
2009 Nov 18
1
R_NilValue and segfault.
...value unit) {
> CAMLparam1(unit);
> CAMLreturn(Val_sexp(R_NilValue));
> }
OCaml code is straightforward:
> external null_creator : unit -> sexp = "r_null"
> let null = null_creator ()
And I get a segfault:
> Objective Caml version 3.11.1
>
> # R.sexptype (R.sexp "1");;
> - : R.sexptype = R.RealSxp
> # R.sexptype Quantmod.getSymbols;;
> - : R.sexptype = R.PromSxp
The two above are fine, but inspecting the type of R.null gives me a
segfault.
> # R.sexptype R.null;;
> /usr/bin/ocaml-batteries: line 2: 3723 Erreur de segmen...
2023 Nov 15
1
saveRDS()/readRDS() on environments
Dear r-devel,
I was surprised to see that saveRDS() and readRDS() work quite well with
environments, see below:
```
z <- 3 # in global env
y <- new.env()
y$a <- 1
x <- new.env(parent = y)
x$b <- 2
saveRDS(x, "x.RDS")
# in a new session
x <- readRDS("x.RDS")
y <- parent.env(x)
x$b
#> [1] 2
y$a
#> [1] 1
parent.env(y)
#> <environment:
2004 Apr 13
1
shared mem advice
Hi,
I want to write a package where I would use
shared memory for some vectors
Any suggestion is appreciated...
I wonder if the right approach would be to
modify add a modified version of the
allocVector(SEXPTYPE type, int length) function
specifically
shared_mem_id = shmget(shared_mem_key,
SHM_SIZE,
IPC_CREAT);
shared = (SEXP) shmat(shared_mem_id, (void *)0, 0);
my_allocVector(SEXPTYPE type, int length, SEXP
shared...
2014 Aug 22
1
what are labels in struct sxpinfo_struct from Rinternals.h mean?
Dear Rdevelers,
? ? ?The following struct is in the Rinternals.h. I want to know ?the meanings of labels or names like "gp,mark,obj,named,trace....." . TKS!
struct sxpinfo_struct {
? ? SEXPTYPE type ? ? ?: ?5;/* ==> (FUNSXP == 99) %% 2^5 == 3 == CLOSXP
? ? * -> warning: `type' is narrower than values
? ? * ? ? ? ? ? ? ?of its type
? ? * when SEXPTYPE was an enum */
? ? unsigned int obj ? : ?1;
? ? unsigned int named : ?2;
? ? unsigned int gp ? ?: 16;
? ? unsigned int...
2009 Nov 16
0
OCaml-R and xts works!
...#39;zoo'
>
>
> The following object(s) are masked from package:base :
>
> as.Date.numeric
>
> xts now requires a valid TZ variable to be set
> no TZ var is set, setting to TZ=GMT
Printing stuff at "compile-time"... That's ugly, I know...
> # R.sexptype Xts.xts;;
> - : R.sexptype = R.PromSxp
So we indeed have a function.
> # let x = R.eval [Xts.xts];;
> val x : R.sexp = <abstr>
We construct a dummy time series...
> # R.sexptype x;;
> - : R.sexptype = R.RealSxp
> #
Cool...
The xts.ml code is essentially:
> (* You...
2013 Dec 16
1
External pointers and changing SEXPTYPE
Dear Developers,
I've been struggling through writing R extension in C. I've been using
an external pointer to store my data (please see sample below). I
encountered a very weird erroneous behaviour: when I tried to use my
external pointer to a structure holding several types of data,
including SEXPs, I discovered that SEXPs change their types between
returning from initialization
2009 Jan 30
2
Problem installing RMySQL ("S4R.h:40:17: error: S.h: No such file or directory"?)
...h:62:26: error: Rdefines.h: No such file or directory
S4R.h:154:49: error: missing binary operator before token "("
S4R.h:176:49: error: missing binary operator before token "("
In file included from RS-DBI.c:22:
RS-DBI.h:100: error: expected specifier-qualifier-list before 'SEXPTYPE'
RS-DBI.h:170: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:173: error: expected ')' before '*' token
RS-DBI.h:174: error: expected ')' before '*' token
RS-DBI.h:175: error: expe...
2019 May 01
3
anyNA() performance on vectors of POSIXct
...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 && !recursive)) {*
SEXP e0 = PROTECT(lang2(install("is.na"), x));
SEXP e =...
2005 Mar 10
1
R_alloc with more than 2GB (PR#7721)
...String take a long argument as well?
These code excerpts are from R-devel_2005-03-10.tar.gz:
char *R_alloc(long nelem, int eltsize) {
R_size_t size = nelem * eltsize;
SEXP s = allocString(size);
...
}
SEXP allocString(int length) {
return allocVector(CHARSXP, length);
}
SEXP allocVector(SEXPTYPE type, R_len_t length) {
...
case CHARSXP:
size = BYTE2VEC(length + 1);
...
malloc(sizeof(SEXPREC_ALIGN) + size * sizeof(VECREC)))
...
}
2018 Oct 02
3
maximum matrix size
I am now getting the occasional complaint about survival routines that are not able to
handle big data.?? I looked in the manuals to try and update my understanding of max
vector size, max matrix, max data set, etc; but it is either not there or I missed it (the
latter more likely).?? Is it still .Machine$integer.max for everything??? Will that
change??? Found where?
I am going to need to go
1999 Nov 23
1
as.name() is not idempotent (PR#337)
as.name(as.name("ss"))
gives an error in R (0.90 and earlier)
but should of course give the same as simply
as.name("ss")
This reminds me of similar bug/problem... which I don't recall.
Yes, I should build tests like these into "make test-Specific" ..
Martin
--please do not edit the information below--
Version:
platform = sparc-sun-solaris2.5.1
arch =
2019 May 21
0
anyNA() performance on vectors of POSIXct
...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 && !recursive)) {*
> SEXP e0 = PROTECT(lang2(install("is.na&q...
2003 Jan 18
1
SAS transport files and the foreign package
...1] "numeric" "numeric" "numeric" "numeric" "numeric"
$TEST$width
[1] 3 4 8 8 8
$TEST$index
[1] 1 2 3 4 5
$TEST$position
[1] 0 3 7 15 23
$TEST$name
[1] "RACE" "AGE" "D1" "DT1" "T1"
$TEST$sexptype
[1] 14 14 14 14 14
$TEST$tailpad
[1] 18
$TEST$length
[1] 2
> lookup.xport('test2.xpt')
Same output except tailpad=76, length=124, second dataset ignored.
> read.xport('test.xpt')
RACE AGE D1 DT1 T1
1 2.000063 30.00000 15402 1330767062 40425
2 4.000...
2006 Jul 11
2
Converting SEXP to primitive C types
I'm new to R development, so this may be a trivial question.
In C, How do you convert a SEXP value returned by an R function to a
primitive C type (int, double, char, array, etc.)? I've tried using
the INTEGER(x), VECTOR_ELT(x,i), and similar functions found in /src/
include/Rinternals.h, but doing so results in incorrect results or a
seg-fault.
For example, I modified
2005 Jul 20
1
(PR#8017) build of REventLoop package crashes with 2.1 due
...XP, int, int, Rprt_adj);
> <
> <
> < #if defined(HAVE_WCHAR_H) && defined(SUPPORT_MBCS)
> < #include <wchar.h>
> < #endif
> <
> < /* main/util.c */
> < void UNIMPLEMENTED_TYPE(char *s, SEXP x);
> < void UNIMPLEMENTED_TYPEt(char *s, SEXPTYPE t);
> < Rboolean utf8strIsASCII(char *str);
> < #ifdef SUPPORT_MBCS
> < int utf8clen(char c);
> < #define mbs_init(x) memset(x, 0, sizeof(mbstate_t))
> < size_t Mbrtowc(wchar_t *wc, const char *s, size_t n, mbstate_t *ps);
> < void mbcsToLatin1(char *in, char *ou...
2009 Aug 24
1
hdf5 package segfault when processing large data
Hi there,
I am currently working on something that uses hdf5 library. I think
hdf5 is a great data format, I've used it somewhat extensively in
python via PyTables. I was looking for something similar to that in R.
The closest I can get is this library: hdf5. While it does not work
the same way as PyTables did, but it's good enough to let them
exchange data via hdf5 file.
There is just 1
2008 May 09
1
Have you ever experienced this problem with REAL in a C code
Dear all,
I'm currently experiencing big troubles with my C code called by .Call
in a R function.
I know this may not be the right place for such things but these errors
are driving me crazy. And I hope other people may have already
experienced these problems so that they could give me good suggestions.
Sorry if I'm completely out of topic.
Well let's go...
I'm writing a
2005 Jul 19
0
build of REventLoop package crashes with 2.1 due tosyntax error in Defn.h (PR#8017)
...;
<
872,939c864
< char *EncodeString(SEXP, int, int, Rprt_adj);
<
<
< #if defined(HAVE_WCHAR_H) && defined(SUPPORT_MBCS)
< #include <wchar.h>
< #endif
<
< /* main/util.c */
< void UNIMPLEMENTED_TYPE(char *s, SEXP x);
< void UNIMPLEMENTED_TYPEt(char *s, SEXPTYPE t);
< Rboolean utf8strIsASCII(char *str);
< #ifdef SUPPORT_MBCS
< int utf8clen(char c);
< #define mbs_init(x) memset(x, 0, sizeof(mbstate_t))
< size_t Mbrtowc(wchar_t *wc, const char *s, size_t n, mbstate_t *ps);
< void mbcsToLatin1(char *in, char *out);
< Rboolean mbcsValid(ch...
2003 Oct 04
3
More questions about R extension programming
.../local/lib -o loadset.so loadset.o
How can I coerce/convert the SEXP type to a char*?
2) The function returns a list object whose elements themselves are
lists. Is there any way I can make those elements arrays rather than
lists? I see in Rinternals.h there is a function defined as
Rf_allocArray(SEXPTYPE, SEXP);
What do I need to supply for the second argument? Could I use this
function rather than allocVector() to create an actual array object? And
then say set elements with
INTEGER(anarray)[0] = 1
or are the 'getter'/'setter' functions for arrays different ( I could'nt
see...