Displaying 20 results from an estimated 52 matches for "symsxp".
2012 Apr 16
1
eval a SYMSXP from C
Can someone offer some advice on how to properly evaluate a SYMSXP
from a .Call ?
I have the following in R:
variable xn, with an attribute "mu" which references the variable mu
in the global environment.
I know "references" is a loose term; mu was defined in this fashion as
a way to implement deferred binding:
foo <- function(x,mu) {...
2006 Jun 03
3
More on bug 7924
...1444
1444 (x->sxpinfo.named) = v;
$1 = 0x85cfd8
$2 = {sxpinfo = {type = 13, obj = 0, named = 2, gp = 0, mark = 1,
debug = 0,
trace = 0, fin = 0, gcgen = 0, gccls = 1}, attrib = 0x508818,
gengc_next_node = 0x6db278, gengc_prev_node = 0x8442b8, u =
{primsxp = {
offset = 2}, symsxp = {pname = 0x2, value = 0x230002acc2,
internal = 0x21000090}, listsxp = {carval = 0x2, cdrval =
0x230002acc2,
tagval = 0x21000090}, envsxp = {frame = 0x2, enclos =
0x230002acc2,
hashtab = 0x21000090}, closxp = {formals = 0x2, body =
0x230002acc2,
env = 0x21000090},...
2019 Jul 17
2
ALTREP wrappers and factors
...(mode=3, len=3, mem=0)
Here is what I get without a wrapper:
> fc1 <- structure(y, class="factor", levels=levels(x))
> .Internal(inspect(fc1))
@7fb0cae66408 13 INTSXP g0c2 [OBJ,NAM(2),ATT] (len=3, tl=0) 1,1,2
ATTRIB:
@7fb0ce771868 02 LISTSXP g0c0 []
TAG: @7fb0c80043d0 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "class" (has value)
@7fb0c9fcbe90 16 STRSXP g0c1 [NAM(7)] (len=1, tl=0)
@7fb0c80841a0 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] "factor"
TAG: @7fb0c8004050 01 SYMSXP g1c0 [MARK,NAM(7),LCK,gp=0x4000] "levels" (has value)...
2010 May 14
1
The parsing of '{' and a function that equal to '{'
Hello All,
I tried the sample code from the help. Although '{' is assigned to
'do', the call syntaxes for 'do' and '{' are not the same ('do' has
','s, but '{' has line breaks). I guess there is a difference in
parsing the code block of 'do' and the code block of '{'. Could you
please let me know some internal details so that
2014 Apr 02
0
special handling of row.names
...data.frame, the compact form is c(NA_integer_,-n), as in:
> d <- data.frame(x=1:10)
> .Internal(inspect(d))
@104f174a8 19 VECSXP g0c1 [OBJ,NAM(2),ATT] (len=1, tl=0)
@103a7dc60 13 INTSXP g0c4 [] (len=10, tl=0) 1,2,3,4,5,...
ATTRIB:
@104959380 02 LISTSXP g0c0 []
TAG: @100823078 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "names" (has value)
@104f17748 16 STRSXP g0c1 [NAM(2)] (len=1, tl=0)
@10085c678 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] "x"
TAG: @10082d060 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "row.names" (has value)
@104f0e898 13 INT...
2019 Jul 18
0
ALTREP wrappers and factors
...0002384f530 14 REALSXP g0c3 [NAM(1)] (len=3, tl=0) 1,2,3
> > attr(a,"dim")=c(1,3)
> > .Internal(inspect(a))
> @0x000000002384f530 14 REALSXP g0c3 [NAM(1),ATT] (len=3, tl=0) 1,2,3
> ATTRIB:
> @0x0000000023864b58 02 LISTSXP g0c0 []
> TAG: @0x00000000044b1a90 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "dim"
> (has value)
> @0x000000002384cb48 13 INTSXP g0c1 [NAM(7)] (len=2, tl=0) 1,3
>
*This would cause a duplication, even though the function test does
nothing.*
> > test<-function(x) x1=x
> > a=c(1,2,3)
> > .Internal(inspect...
2011 Nov 24
1
Confused about NAMED
...NAM(1) as expected but why different to x?
@272f788 13 INTSXP g0c4 [NAM(1)] (len=10, tl=0) 1,2,3,4,5,...
> z = data.frame()
> .Internal(inspect(z)) # why NAM(2)? expected NAM(1)
@24fc28c 19 VECSXP g0c0 [OBJ,NAM(2),ATT] (len=0, tl=0)
ATTRIB:
@24fc270 02 LISTSXP g0c0 []
TAG: @3f2120 01 SYMSXP g0c0 [MARK,gp=0x4000] "names"
@24fc334 16 STRSXP g0c0 [] (len=0, tl=0)
TAG: @3f2040 01 SYMSXP g0c0 [MARK,gp=0x4000] "row.names"
@24fc318 13 INTSXP g0c0 [] (len=0, tl=0)
TAG: @3f2388 01 SYMSXP g0c0 [MARK,gp=0x4000] "class"
@25be500 16 STRSXP g0c1 []...
2016 May 20
2
identical on closures
..., 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 g0c0 [MARK,ATT]
@604998 01 SYMSXP g0c0 [MARK,LCK,gp=0x5000] "{" (has value)
ATTRIB:
@cc9570 02 LISTSXP g0c0 [MARK]
TAG: @60dd70 01 SYMSXP g0c0 [MARK,LCK,gp=0x4000] "srcref" (has value)
@15a65d8 19 VECSXP g0c1 [MARK] (len=1, tl=0)
@10f3dd0 13 INTSXP g0c3 [OBJ,MARK,ATT] (len=8, tl=0) 1,15,1,1...
2010 Nov 12
1
SEXPs and slots
Hello,
I've created this class:
setClass("example",
representation (
size = "numeric",
id = "character"
)
)
Suppose I create a new instance of this class:
> x <- new("example", 4, "id_value")
This creates an S4 object with two slots. Am I correct in thinking that
slots are "filled" by SEXPs?
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
2019 Jul 19
2
ALTREP wrappers and factors
...gt;
> > > fc1 <- structure(y, class="factor", levels=levels(x))
> > > .Internal(inspect(fc1))
> > @7fb0cae66408 13 INTSXP g0c2 [OBJ,NAM(2),ATT] (len=3, tl=0) 1,1,2
> > ATTRIB:
> > @7fb0ce771868 02 LISTSXP g0c0 []
> > TAG: @7fb0c80043d0 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "class" (has
> > value)
> > @7fb0c9fcbe90 16 STRSXP g0c1 [NAM(7)] (len=1, tl=0)
> > @7fb0c80841a0 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached]
> > "factor"
> > TAG: @7fb0c8004050 01 SYMSXP g1c0 [MARK,NAM(7)...
2011 Aug 13
1
Latent flaw in SEXPREC definition
There seems to be a latent flaw in the definition of struct SEXPREC
in Rinternals.h, which likely doesn't cause problems now, but could
if the relative sizes of data types changes.
The SEXPREC structure contains a union that includes a primsxp,
symsxp, etc, but not a vecsxp. However, in allocVector in memory.c,
zero-length vectors are allocated using allocSExpNonCons, which
appears to allocates a SEXPREC structure. This won't work if a vecsxp
is larger than the other types that are in the union in the SEXPREC
structure.
Simply adding a ve...
2015 Jan 09
0
RFC: getifexists() {was [Bug 16065] "exists" ...}
...;
>>
>> A null default is fine -- it's a default; if it isn't right for a
>> particular case you can provide something else.
>>
>>
>>> But another idea (and one pretty similar to John's) is to follow the
>>> SYMSXP
>>> design at the C level, where there is a structure that points to the name
>>> and a value. We already have SYMSXPs at the R level of course (name
>>> objects) but they do not provide access to the value, which is typically
>>> R_UnboundValue....
2003 Dec 16
1
Memory issues in "aggregate" (PR#5829)
...st <- aggregate(duration, list(Delta), length)
> colnames(pseudo.hist) <- c("Delta", "N")
> detach(profiles)
> gc()
used (Mb) gc trigger (Mb)
Ncells 701188 18.8 2683553 71.7
Vcells 1447712 11.1 8201413 62.6
> memory.profile()
NILSXP SYMSXP LISTSXP CLOSXP ENVSXP PROMSXP LANGSXP
1 7228 244243 3949 495 773 113819
SPECIALSXP BUILTINSXP CHARSXP LGLSXP INTSXP
207 1177 283663 4661 0 0 49
REALSX...
2009 Sep 29
3
How do I access class slots from C?
Hi
I'm trying to implement something similar to the following R snippet using
C. I seem to have hit the wall on accessing class slots using C.
library(fPortfolio)
lppData <- 100 * LPP2005.RET[, 1:6]
ewSpec <- portfolioSpec()
nAssets <- ncol(lppData)
setWeights(ewSpec) <- rep(1/nAssets, times = nAssets)
ewPortfolio <- feasiblePortfolio(
data = lppData,
spec = ewSpec,
2020 Jan 09
6
Get memory address of an R data frame
Hello,
I would like for my C function to be able to manipulate some values stored in an R data frame.
To achieve this, a need the (real) memory address where the R data frame stores its data (hopefully in a contiguous way). Then, from R, I call the C function and passing this memory address as a parameter.
The question: how can we get the memory address of the R data frame?
Thank you!
L.
2020 Jan 09
0
Get memory address of an R data frame
...lt;-
tracemem[0x55aa778f6868 -> 0x55aa778f5b48]: [<-.data.frame [<-
> .Internal(inspect(x)) @55aa743e0bc0 19 VECSXP g0c1
[OBJ,MARK,NAM(7),TR,ATT] (len=1, tl=0) @55aa7440d420 13 INTSXP g0c0
[MARK,NAM(7)] 1 : 10 (compact) ATTRIB: @55aa743f9ea0 02 LISTSXP g0c0 [MARK]
TAG: @55aa72ac98a0 01 SYMSXP g0c0 [MARK,NAM(7),LCK,gp=0x6000] "names" (has
value) @55aa743e0fb0 16 STRSXP g0c1 [MARK,NAM(7)] (len=1, tl=0)
@55aa72be1c70 09 CHARSXP g0c1 [MARK,gp=0x61] [ASCII] [cached] "z" TAG:
@55aa72ac9d70 01 SYMSXP g0c0 [MARK,NAM(7),LCK,gp=0x4000] "class" (has
value) @55aa73ca59...
2005 Jun 29
1
Viewing R objects in gdb
...This is exactly what an example in the R Extensions manual
section 4.11.2 "Inspecting R objects when debugging" does, but the code
there doesn't work, presumably because the R internals have changed
since it was written.
Specifically, I get
(gdb) p $a->u.listsxp.tagval->u.symsxp.pname->u.vecsxp.type.c
Error: There is no member named vecsxp.
where $a was set to be the attrib member of an SEXP.
Could someone let me know what needs to be fixed for this to work? I
imagine it's a typecast, but I haven't been able to put it together.
(An example using R_PV to pri...
2001 Dec 07
2
Memory problem
Dear all,
I have written a little R program to convert images. See below. Within the
loop over j (the filenames) memory consumption grows constantly. rm( ... )
inside the loop did not help. Memory does not grow if I remove the writeBin
statements between the two #-------- marks. But obviously this is not
solution I want...
Thanks for any advice.
Manfred Baumstark
P.S. As I'm new to R:
2015 Jan 08
2
RFC: getifexists() {was [Bug 16065] "exists" ...}
...tes
>> an unbound value (like R_UnboundValue).
>>
>
> A null default is fine -- it's a default; if it isn't right for a
> particular case you can provide something else.
>
>
>> But another idea (and one pretty similar to John's) is to follow the
>> SYMSXP
>> design at the C level, where there is a structure that points to the name
>> and a value. We already have SYMSXPs at the R level of course (name
>> objects) but they do not provide access to the value, which is typically
>> R_UnboundValue. But this does not even need to b...