search for: xlength

Displaying 20 results from an estimated 30 matches for "xlength".

Did you mean: length
2015 May 17
1
The function cummax() seems to have a bug.
Hi, The function cummax() seems to have a bug. > x <- c(NA, 0) > storage.mode(x) <- "integer" > cummax(x) [1] NA 0 The correct result of this case should be NA NA. The mistake in [ https://github.com/wch/r-source/blob/trunk/src/main/cum.c#L130-L136] may be the reason. Best Regards, Dongcan -- Dongcan Jiang Team of Search Engine & Web Mining School of Electronic
2013 Jul 12
1
robustbase compilation problem: probably boneheaded? maybe 32-bit?
...ruct { R_xlen_t lv_length, lv_truelength; } R_long_vec_hdr_t; # define R_XLEN_T_MAX 4503599627370496 # define R_SHORT_LEN_MAX 2147483647 # define R_LONG_VEC_TOKEN -1 #else typedef int R_xlen_t; # define R_XLEN_T_MAX R_LEN_T_MAX #endif while robustbase has #ifndef LONG_VECTOR_SUPPORT # ifndef XLENGTH // for R <= 2.15.x : # define XLENGTH(x) LENGTH(x) typedef int R_xlen_t; # endif #endif It seems the problem is that I have #define SIZEOF_SIZE_T 4 in my config.log , which in turn turns off LONG_VECTOR_SUPPORT, which is otherwise (?) assumed only to be true for R<=2.15.x ... can...
2018 Aug 30
3
ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1
...ot;. Thank you, Henrik, for bringing it up! In practice I think we should start having a warning signalled. I have checked the source code in the mean time, and the check is really very cheap { because it can/should be done after checking isNumber(): so then we know we have an atomic and can use XLENGTH() } The 0-length case I don't think we should change as I do find NA (is logical!) to be an appropriate logical answer. Martin Maechler ETH Zurich and R Core team. > Cheers Joris > -- > Joris Meys Statistical consultant
2019 Jan 21
2
pmax and long vector
..., 3*10^9), 0) > > > > Error in pmax(rep(1L, 3 * 10^9), 0) : > > long vectors not supported yet: > > ../../../R-devel-src/src/include/Rinlinedfuns.h:522 > > > I think a carefully tested patch that fixes pmax (it would need to > change this call from length() to xlength(), and make some other > necessary changes that follow from this), would probably be useful to R > Core, and could be posted to bugs.r-project.org. > > It might also be useful on R-devel to post a list of all known commonly > used functions that don't support long vectors; this c...
2018 Apr 19
2
R Bug: write.table for matrix of more than 2, 147, 483, 648 elements
...re appears to be no solution or fixes in upcoming R version releases. > > The error message is coming from the writetable part of the utils package in the io.c source code(https://svn.r-project.org/R/trunk/src/library/utils/src/io.c): > /* quick integrity check */ > if(XLENGTH(x) != (R_len_t)nr * nc) > error(_("corrupt matrix -- dims not not match length")); > > The issue is that nr*nc is an integer and the size of my matrix, 2.8 billion elements, exceeds C's limit, so the check forces the code to fail. Yes, looks like a typo...
2019 May 01
3
anyNA() performance on vectors of POSIXct
...p;& !recursive)) {* SEXP e0 = PROTECT(lang2(install("is.na"), x)); SEXP e = PROTECT(lang2(install("any"), e0)); SEXP res = PROTECT(eval(e, env)); int ans = asLogical(res); UNPROTECT(3); return ans == 1; // so NA answer is false. } R_xlen_t i, n = xlength(x); switch (xT) { case REALSXP: { 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; }); break; } [[alternative HTML vers...
2020 Jan 20
1
Minor bug in error message in datetime.c
...ain/datetime.c +++ b/src/main/datetime.c @@ -1048,7 +1048,7 @@ SEXP attribute_hidden do_strptime(SEXP call, SEXP op, SEXP args, SEXP env) if(!isString((x = CAR(args)))) error(_("invalid '%s' argument"), "x"); if(!isString((sformat = CADR(args))) || XLENGTH(sformat) == 0) - error(_("invalid '%s' argument"), "x"); + error(_("invalid '%s' argument"), "format"); One could spend quite some time figuring out what is wrong with his ?x?, when the problem is with ?format? :) Kind...
2019 Jan 21
2
pmax and long vector
I see that base::pmax() does not support long vectors. Is R-devel interested in reports like this; ie. is there a goal of full support for long vectors in "basic" functions, something I at least would greatly appreciate? MRE: > pmax(rep(1L, 3*10^9), 0) Error in pmax(rep(1L, 3 * 10^9), 0) : long vectors not supported yet: ../../../R-devel-src/src/include/Rinlinedfuns.h:522 Best,
2006 Dec 25
2
Problem to generate training data set and test data set
I have a full data set like this: aa bas aas bms ams bcu acu omega y 1 ALA 0 127.71 0 69.99 0 -0.2498560 79.91470 outward 2 PRO 0 68.55 0 55.44 0 -0.0949008 76.60380 outward 3 ALA 0 52.72 0 47.82 0 -0.0396550 52.19970 outward 4 PHE 0 22.62 0 31.21 0 0.1270330 169.52500 inward 5 SER 0 71.32 0 52.84 0 -0.1312380 7.47528 outward 6
2015 Sep 20
2
Long vectors: Missing values and R_xlen_t?
Is there a missing value constant defined for R_xlen_t, cf. NA_INTEGER (== R_NaInt == INT_MIN) for int(eger)? If not, is it correct to assume that missing values should be taken care/tested for before coercing from int or double? Thank you, Henrik
2018 Apr 19
3
R Bug: write.table for matrix of more than 2, 147, 483, 648 elements
...releases. >>> >>> The error message is coming from the writetable part of the utils >>> package in the io.c source >>> code(https://svn.r-project.org/R/trunk/src/library/utils/src/io.c): >>> /* quick integrity check */ >>> ???????????????? if(XLENGTH(x) != (R_len_t)nr * nc) >>> ???????????????????? error(_("corrupt matrix -- dims not not match >>> length")); >>> >>> The issue is that nr*nc is an integer and the size of my matrix, 2.8 >>> billion elements, exceeds C's limit, so the che...
2019 Jan 05
1
unsorted - suggestion for performance improvement and ALTREP support for POSIXct
...ng it twice inside the loop. As an aside, it is implemented in the faster way in doSort() (sort.c line 401). The example below shows the performance improvement for a vectors of double of moving REAL() outside the for loop. # example as implemented in isUnsorted body = " R_xlen_t n, i; n = XLENGTH(x); for(i = 0; i+1 < n ; i++) if(REAL(x)[i] > REAL(x)[i+1]) return ScalarLogical(TRUE); return ScalarLogical(FALSE);"; f1 = inline::cfunction(sig = signature(x='numeric'), body=body) # example updated with only one call to REAL() body = " R_xlen_t n, i; n = XLENGTH(x);...
2012 Nov 15
1
bug with mapply() on an S4 object
Hi, Starting with ordinary vectors, so we know what to expect: > mapply(function(x, y) {x * y}, 101:106, rep(1:3, 2)) [1] 101 204 309 104 210 318 > mapply(function(x, y) {x * y}, 101:106, 1:3) [1] 101 204 309 104 210 318 Now with an S4 object: setClass("A", representation(aa="integer")) a <- new("A", aa=101:106) > length(a)
2018 Apr 18
1
R Bug: write.table for matrix of more than 2, 147, 483, 648 elements
...e no > solution or fixes in upcoming R version releases. > > The error message is coming from the writetable part of the utils package > in the io.c source code(https://svn.r- > project.org/R/trunk/src/library/utils/src/io.c): > /* quick integrity check */ > if(XLENGTH(x) != (R_len_t)nr * nc) > error(_("corrupt matrix -- dims not not match > length")); > > The issue is that nr*nc is an integer and the size of my matrix, 2.8 > billion elements, exceeds C's limit, so the check forces the code to fail. > > My...
2018 Aug 31
1
ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1
...> In practice I think we should start having a warning signalled. > I have checked the source code in the mean time, and the check > is really very cheap > { because it can/should be done after checking isNumber(): so > then we know we have an atomic and can use XLENGTH() } > > > The 0-length case I don't think we should change as I do find > NA (is logical!) to be an appropriate logical answer. Can you explain your reasoning a bit more here? I'd like to understand the general principle, because from my perspective...
2015 Sep 21
0
Long vectors: Missing values and R_xlen_t?
...gt; Is there a missing value constant defined for R_xlen_t, cf. NA_INTEGER > (== R_NaInt == INT_MIN) for int(eger)? If not, is it correct to > assume that missing values should be taken care/tested for before > coercing from int or double? > R_xlen_t is type of the vector length (see XLENGTH()) and as such never holds a missing value (since there is no such thing as a missing length). It is *not* a native type for R vectors and therefore there is no official representation of NAs in R_xlen_t. Although native R vectors can be used as indices, the way it typically works is that the code...
2018 Apr 18
0
R Bug: write.table for matrix of more than 2, 147, 483, 648 elements
...d=17182. However, there appears to be no solution or fixes in upcoming R version releases. The error message is coming from the writetable part of the utils package in the io.c source code(https://svn.r-project.org/R/trunk/src/library/utils/src/io.c): /* quick integrity check */ if(XLENGTH(x) != (R_len_t)nr * nc) error(_("corrupt matrix -- dims not not match length")); The issue is that nr*nc is an integer and the size of my matrix, 2.8 billion elements, exceeds C's limit, so the check forces the code to fail. My version: > R.Version() $platform...
2018 Apr 19
0
R Bug: write.table for matrix of more than 2, 147, 483, 648 elements
...ming R >> version releases. >> >> The error message is coming from the writetable part of the utils >> package in the io.c source >> code(https://svn.r-project.org/R/trunk/src/library/utils/src/io.c): >> /* quick integrity check */ >> ???????????????? if(XLENGTH(x) != (R_len_t)nr * nc) >> ???????????????????? error(_("corrupt matrix -- dims not not match >> length")); >> >> The issue is that nr*nc is an integer and the size of my matrix, 2.8 >> billion elements, exceeds C's limit, so the check forces the code t...
2018 Aug 30
0
ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1
...ringing it up! > > In practice I think we should start having a warning signalled. > I have checked the source code in the mean time, and the check > is really very cheap > { because it can/should be done after checking isNumber(): so > then we know we have an atomic and can use XLENGTH() } > > > The 0-length case I don't think we should change as I do find > NA (is logical!) to be an appropriate logical answer. Can you explain your reasoning a bit more here? I'd like to understand the general principle, because from my perspective it's more parsimonious t...
2019 Jan 21
0
pmax and long vector
...> MRE: > >> pmax(rep(1L, 3*10^9), 0) > > Error in pmax(rep(1L, 3 * 10^9), 0) : > long vectors not supported yet: > ../../../R-devel-src/src/include/Rinlinedfuns.h:522 I think a carefully tested patch that fixes pmax (it would need to change this call from length() to xlength(), and make some other necessary changes that follow from this), would probably be useful to R Core, and could be posted to bugs.r-project.org. It might also be useful on R-devel to post a list of all known commonly used functions that don't support long vectors; this could be updated on a...