Displaying 14 results from an estimated 14 matches for "no_na".
2019 Sep 03
2
[ALTREP] What is the meaning of the return value of Is_sorted and No_NA function?
Hi,
I would like to figure out the meaning of the return value of these two
functions. Here are the default definitions I find from R source code:
static int altreal_Is_sorted_default(SEXP x) { return UNKNOWN_SORTEDNESS; }
static int altreal_No_NA_default(SEXP x) { return 0; }
I guess the macro *UNKNOWN_SORTEDNESS *in *Is_sorted* and 0 in *No_NA
*simply means
unknown sorted/NA status of the vector, so R will loop over the vector and
find the answer. However, what should we return in these functions to
indicate whether the vector has been so...
2019 Sep 11
1
[ALTREP] What is the meaning of the return value of Is_sorted and No_NA function?
...e a wired reply from me saying that I
have found the answer from the R source code, it was sent from me last
week. Hopefully, this reply will not cost another week to post:)
As a side note, I like the idea that defining a macro for sortedness, and I
can see why we can only have a binary answer for NO_NA (since the return
value is actually bool). For making the code more readable, and for
possibly working with the future R release, is it possible to define a
macro for NO_NA function in RInternal.h? So if there is any change in NO_NA
function, there is no need to modify the code. Also, the code can...
2019 Sep 11
0
[ALTREP] What is the meaning of the return value of Is_sorted and No_NA function?
...NA_1ST = -2,
SORTED_DECR = -1,
UNKNOWN_SORTEDNESS = INT_MIN, /*INT_MIN is NA_INTEGER! */
SORTED_INCR = 1,
SORTED_INCR_NA_1ST = 2,
KNOWN_UNSORTED = 0};
The default value there is NA_INTEGER (ie INT_MIN), indicating that there
is no sortedness information.
Currently, *_NO_NA effectively return a boolean, (even though the actual
return value is int). This can be seen in the method we provide for compact
sequences in altclasses.c:
static int compact_intseq_No_NA(SEXP x)
{
#ifdef COMPACT_INTSEQ_MUTABLE
/* If the vector has been expanded it may have been modified. *...
2019 Sep 04
0
[ALTREP] What is the meaning of the return value of Is_sorted and No_NA function?
...NT_MIN, /*INT_MIN is NA_INTEGER! */
SORTED_INCR = 1,
SORTED_INCR_NA_1ST = 2,
KNOWN_UNSORTED = 0};
The macro names are pretty self-explanatory. The current implementation
only supports the ascending sort.
2. For anyNA, it goes to(Real SEXP)
===========coerce.c===========
if(REAL_NO_NA(x))
return FALSE;
ITERATE_BY_REGION(x, xD, i, nbatch, double, REAL, {
for (int k = 0; k < nbatch; k++)
if (ISNAN(xD[k]))
return TRUE;
});
===========altrep.c===========
int REAL_NO_NA(SEXP x)
{
return ALTREP(x) ? ALTREAL_DISPATCH(No_NA, x) : 0;
}
If the argument x is not an ALTREP...
2012 Sep 19
4
correlating matrices
Hi,
thank you for taking the time and reading my question. My question is
twofold:
1. I have several matrices with variables and one matrix with water levels.
I want to predict the water level with the data in the other matrices.
Basically,
* mod<-lm(matrix1 ~ matrix2+matrix3)*
( What looks like a minus is meant to be the wiggly minus.)
Of course I could dissemble the matrices and paste
2019 May 16
3
ALTREP: Bug reports
...tly, we will only
see one message. following my last example
> .Internal(inspect(so1))
> @0x0000000005e7fbb0 14 REALSXP g0c0 [MARK,NAM(7)] Share object of type
> double
> > .Internal(inspect(so2))
> @0x0000000005fc5ac0 14 REALSXP g0c0 [MARK,NAM(7)] wrapper
> [srt=-2147483648,no_na=0]
> @0x0000000005e7fbb0 14 REALSXP g0c0 [MARK,NAM(7)] Share object of type
> double
> > sm1=peekSharedMemory(so1)
> getting data 1
> > sm2=peekSharedMemory(so2)
> getting data 1
> getting data 1
We see that so2 call R_altrep_data1 twice to get the internal data. Thi...
2019 May 16
3
ALTREP: Bug reports
...t1
> alt2[1]=10
> .Internal(inspect(alt1))
> .Internal(inspect(alt2))
The result would be:
> .Internal(inspect(alt1))
> @0x00000000156f4d18 14 REALSXP g0c0 [NAM(7)]
> > .Internal(inspect(alt2 ))
> @0x00000000156a33e0 14 REALSXP g0c0 [NAM(7)] wrapper
> [srt=-2147483648,no_na=0]
> @0x00000000156f4d18 14 REALSXP g0c0 [NAM(7)]
It seems like the object alt2 automatically gets wrapped by R. Although at
the R level it seems fine because there are no differences between alt1 and
alt2, if we define a C function as:
SEXP C_peekSharedMemory(SEXP x) {
> return(R_altrep...
2019 Jul 17
2
ALTREP wrappers and factors
...0c90ba728 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] "b"
Here is what I get with a wrapper:
> fc2 <- structure(.Internal(wrap_meta(y, 0, 0)), class="factor", levels=levels(x))
> .Internal(inspect(fc2))
@7fb0ce764630 13 INTSXP g0c0 [OBJ,NAM(2),ATT] wrapper [srt=0,no_na=0]
@7fb0ce78c0f0 13 INTSXP g0c0 [NAM(7)] matter vector (mode=3, len=3, mem=0)
ATTRIB:
@7fb0ce764668 02 LISTSXP g0c0 []
TAG: @7fb0c80043d0 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "class" (has value)
@7fb0c9fcb010 16 STRSXP g0c1 [NAM(7)] (len=1, tl=0)
@7fb0c80841a0 09 CHARSXP...
2020 Jul 22
3
Invisible names problem
I ran into strange behavior when removing names.
Two ways of removing names:
i <- rep(1:4, length.out=20000)
k <- c(a=1, b=2, c=3, d=4)
x1 <- unname(k[i])
x2 <- k[i]
x2 <- unname(x2)
Are they identical?
identical(x1,x2) # TRUE
but no
identical(serialize(x1,NULL),serialize(x2,NULL)) # FALSE
But problem is with serialization type 3, cause:
2019 May 16
0
ALTREP: Bug reports
...sage. following my last example
>
> > .Internal(inspect(so1))
>> @0x0000000005e7fbb0 14 REALSXP g0c0 [MARK,NAM(7)] Share object of type
>> double
>> > .Internal(inspect(so2))
>> @0x0000000005fc5ac0 14 REALSXP g0c0 [MARK,NAM(7)] wrapper
>> [srt=-2147483648,no_na=0]
>> @0x0000000005e7fbb0 14 REALSXP g0c0 [MARK,NAM(7)] Share object of type
>> double
>> > sm1=peekSharedMemory(so1)
>> getting data 1
>> > sm2=peekSharedMemory(so2)
>> getting data 1
>> getting data 1
>
>
> We see that so2 call R_altrep_...
2019 Jul 19
2
ALTREP wrappers and factors
...ot;
> >
> > Here is what I get with a wrapper:
> >
> > > fc2 <- structure(.Internal(wrap_meta(y, 0, 0)), class="factor",
> > levels=levels(x))
> > > .Internal(inspect(fc2))
> > @7fb0ce764630 13 INTSXP g0c0 [OBJ,NAM(2),ATT] wrapper [srt=0,no_na=0]
> > @7fb0ce78c0f0 13 INTSXP g0c0 [NAM(7)] matter vector (mode=3, len=3,
> > mem=0)
> > ATTRIB:
> > @7fb0ce764668 02 LISTSXP g0c0 []
> > TAG: @7fb0c80043d0 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "class" (has
> > value)
> > @7fb0c9fcb010...
2020 Jul 22
0
Invisible names problem
...;
@7fa24ba575c8 09 CHARSXP g0c1 [MARK,REF(35005),gp=0x61] [ASCII] [cached] "a"
...
> .Internal(inspect(unname(k[i])))
@10a50c000 14 REALSXP g0c7 [] (len=20000, tl=0) 1,2,3,4,1,...
> .Internal(inspect(x2))
@7fa24fc692d8 14 REALSXP g0c0 [REF(1)] wrapper [srt=-2147483648,no_na=0]
@10a228000 14 REALSXP g0c7 [REF(1),ATT] (len=20000, tl=0) 1,2,3,4,1,...
ATTRIB:
@7fa24fc69850 02 LISTSXP g0c0 [REF(1)]
TAG: @7fa24b803e90 01 SYMSXP g0c0 [MARK,REF(5797),LCK,gp=0x4000] "names" (has value)
@10a250000 16 STRSXP g0c7 [REF(65535)] (len=20000, tl=0)
@7f...
2019 May 16
0
ALTREP: Bug reports
...)
> > .Internal(inspect(alt2))
>
>
> The result would be:
>
> > .Internal(inspect(alt1))
> > @0x00000000156f4d18 14 REALSXP g0c0 [NAM(7)]
> > > .Internal(inspect(alt2 ))
> > @0x00000000156a33e0 14 REALSXP g0c0 [NAM(7)] wrapper
> > [srt=-2147483648,no_na=0]
> > @0x00000000156f4d18 14 REALSXP g0c0 [NAM(7)]
>
>
> It seems like the object alt2 automatically gets wrapped by R. Although at
> the R level it seems fine because there are no differences between alt1 and
> alt2, if we define a C function as:
>
So I'm not sure w...
2019 Jul 18
0
ALTREP wrappers and factors
...p=0x61] [ASCII] [cached] "b"
>
> Here is what I get with a wrapper:
>
> > fc2 <- structure(.Internal(wrap_meta(y, 0, 0)), class="factor",
> levels=levels(x))
> > .Internal(inspect(fc2))
> @7fb0ce764630 13 INTSXP g0c0 [OBJ,NAM(2),ATT] wrapper [srt=0,no_na=0]
> @7fb0ce78c0f0 13 INTSXP g0c0 [NAM(7)] matter vector (mode=3, len=3,
> mem=0)
> ATTRIB:
> @7fb0ce764668 02 LISTSXP g0c0 []
> TAG: @7fb0c80043d0 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "class" (has
> value)
> @7fb0c9fcb010 16 STRSXP g0c1 [NAM(7)] (len=1, tl...