search for: s4sxp

Displaying 14 results from an estimated 14 matches for "s4sxp".

2019 Oct 21
3
S4SXP type vs S4 object bit?
I'm trying to understand the R internals a bit better and reading over the documentation. I see that there is a bit related to whether an object is S4 (S4_OBJECT_MASK), and also the object type S4SXP (25). The documentation makes clear that these two things aren't the same. But in practice, will the S4-bit and object type ever disagree for S4 objects? I know that one can set the bit manually in C; are there any practical applications for doing so? Thank you Travers [[alternative HTML...
2019 Oct 22
0
S4SXP type vs S4 object bit?
Hi Travers, Just an additional remarks to Michael's answer, if your S4 class inherits from R's basic types, say integer, the resulting object will be an INTSXP. If your S4 class does not inherit from any class, it will be an S4SXP. You can think about this question from the object-oriented framework: If one class inherits the integer class, what should R do to make all the integer related functions compatible with the new class at C level? Best, Jiefei On Tue, Oct 22, 2019 at 4:28 AM Travers Ching <traversc at gmail.com...
2010 Aug 22
1
Handle RAWSXP in inspect.c:typename()
...inspect.c =================================================================== --- src/main/inspect.c (revision 52221) +++ src/main/inspect.c (working copy) @@ -63,6 +63,7 @@ case EXTPTRSXP: return "EXTPTRSXP"; case WEAKREFSXP: return "WEAKREFSXP"; case S4SXP: return "S4SXP"; + case RAWSXP: return "RAWSXP"; default: return "<unknown>"; } Best -- Rory [[alternative HTML version deleted]]
2009 Oct 13
1
for loop over S4
...<- new( "track", x = 1, y = 2 ) > for( i in o ){ + cat( "hello\n") + } Error: invalid type/length (S4/1) in vector allocation This happens at those lines of do_for: n = LENGTH(val); PROTECT_WITH_INDEX(v = allocVector(TYPEOF(val), 1), &vpi); because allocVector( S4SXP, 1) does not make sense. What about detecting S4SXP and attempt to call as.list, similarly to what lapply does ? > as.list.track <- function(x, ...){ list( x = x at x, y = x at y ) } > lapply( o, identity ) $x [1] 1 $y [1] 2 That would make for loops more generic, and make it poss...
2019 Sep 19
2
Should slot<-() alter its first argument?
We noticed that the slot<- function alters its first argument, which goes against the grain of a functional language. The similar @<- does not change its first argument. Is this intended? The timeSeries and distr package depend on this altering. > setClass("Z", rep=representation(x="character")) > z <- new("Z", x="orig") > `@<-`(z,
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?
2010 Nov 15
1
SEXP and slots
...value" >> >> so the @size slot is a numeric vector of length 1 containing the value >> 4. One doesn't really have to know the detailed representation, but one >> can find out from >> >> > .Internal(inspect(eg)) >> @df70e48 25 S4SXP g0c0 [OBJ,NAM(2),gp=0x10,ATT] >> ATTRIB: >> @df70ef0 02 LISTSXP g0c0 [] >> TAG: @769258 01 SYMSXP g1c0 [MARK] "size" >> @c0f6db8 14 REALSXP g0c1 [NAM(2)] (len=1, tl=0) 4 >> TAG: @15b0228 01 SYMSXP g1c0 [MARK,NAM(2)] "id&quot...
2012 Mar 07
1
.Internal(inspect(x)) gives overly verbose output for reference classes
Even for an extremely simple instance of a reference class x <- setRefClass("x") y <- x$new() calling the internal inspect function .Internal(inspect(y)) produces enough output that it takes several minutes to print to the console.? (Actually I gave up and terminated the command after ~10 mins.? It isn't clear whether the output would eventually complete.) Are reference
2009 Jul 09
1
bug in seq_along
Using the IRanges package from Bioconductor and somewhat recent R-2.9.1. ov = IRanges(1:3, 4:6) length(ov) # 3 seq(along = ov) # 1 2 3 as wanted seq_along(ov) # 1! I had expected that the last line would yield 1:3. My guess is that somehow seq_along don't utilize that ov is an S4 class with a length method. The last line of the *Details* section of ?seq has a typeo. Currently it is
2009 Dec 16
2
What is the fastest way to see what are in an RData file?
Currently, I load the RData file then ls() and str(). But loading the file takes too long if the file is big. Most of the time, I only interested what the variables are in the the file and the attributes of the variables (like if it is a data.frame, matrix, what are the colnames/rownames, etc.) I'm wondering if there is any facility in R to help me avoid loading the whole file.
2010 May 17
0
Rcpp 0.8.0 on CRAN
...--------------------------- CLOSXP | BUILTINSXP | Rcpp::Function SPECIALSXP | ---------------------------------------------------------- LANGSXP | Rcpp::Language LISTSXP | Rcpp::Pairlist ---------------------------------------------------------- S4SXP | Rcpp::S4 ---------------------------------------------------------- PROMSXP | Rcpp::Promise WEAKREFSXP | Rcpp::WeakReference EXTPTRSXP | template <typename T> Rcpp::XPtr ---------------------------------------------------------- Some SEXP ty...
2010 May 17
0
Rcpp 0.8.0 on CRAN
...--------------------------- CLOSXP | BUILTINSXP | Rcpp::Function SPECIALSXP | ---------------------------------------------------------- LANGSXP | Rcpp::Language LISTSXP | Rcpp::Pairlist ---------------------------------------------------------- S4SXP | Rcpp::S4 ---------------------------------------------------------- PROMSXP | Rcpp::Promise WEAKREFSXP | Rcpp::WeakReference EXTPTRSXP | template <typename T> Rcpp::XPtr ---------------------------------------------------------- Some SEXP ty...
2024 Apr 24
0
[Rd] R 4.4.0 is released
...* Headers R_ext/Applic.h and R-ext/Linpack.h used to include R_ext/BLAS.h although this was undocumented and unneeded by their documented entry points. They no longer do so. * New function R_missing(), factored out from do_missing(), used to fix PR#18579. * SEXP type S4SXP has been renamed to OBJSXP to support experimenting with alternative object systems. The S4SXP value can still be used in C code but is now deprecated. Based on contributions from the R Consortium's Object-Oriented Programming Working Group. * New function pow1p(x...
2024 Apr 24
0
[Rd] R 4.4.0 is released
...* Headers R_ext/Applic.h and R-ext/Linpack.h used to include R_ext/BLAS.h although this was undocumented and unneeded by their documented entry points. They no longer do so. * New function R_missing(), factored out from do_missing(), used to fix PR#18579. * SEXP type S4SXP has been renamed to OBJSXP to support experimenting with alternative object systems. The S4SXP value can still be used in C code but is now deprecated. Based on contributions from the R Consortium's Object-Oriented Programming Working Group. * New function pow1p(x...