diff --git a/DESCRIPTION b/DESCRIPTION index 42aafed..4cdcc43 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: kit Type: Package Title: Data Manipulation Functions Implemented in C Version: 0.0.17 -Date: 2024-04-25 +Date: 2024-05-03 Authors@R: c(person("Morgan", "Jacob", role = c("aut", "cre", "cph"), email = "morgan.emailbox@gmail.com"), person("Sebastian", "Krantz", role = "ctb")) Author: Morgan Jacob [aut, cre, cph], Sebastian Krantz [ctb] diff --git a/MD5 b/MD5 index 0d95247..7665be6 100644 --- a/MD5 +++ b/MD5 @@ -1,7 +1,7 @@ 6071edd604dbeb75308cfbedc7790398 *cleanup d2761d00effd7b096a5bea21bc38742e *configure -84c00d2038959aeab8360c78c40b4d98 *DESCRIPTION -1c23c84234162f70c2f2ad986476697e *inst/NEWS.Rd +19158cf849aa973c876999d7c349e5f6 *DESCRIPTION +579d6713a55c0d47166988596a7defe5 *inst/NEWS.Rd a87b0f223435ed35607e8514562b8bfe *LICENSE 2ddfa8d8739668eedda260e6ddc935d4 *man/charToFact.Rd 8f19a2c9feb2f352580fd4892650f285 *man/count.Rd @@ -18,7 +18,7 @@ a7f31cee15b9624dab8f4d13d3c66bad *man/vswitch.Rd c797ca387dccc02751cfe85108fb0159 *NAMESPACE 1eb8bec6ee346933bfbff2acda381402 *R/call.R 2d6c06dfc570d456af125c160cf150d7 *README.md -4bd66ada38968d317edfb6f3dd95c947 *src/dup.c +f8a685dd117b590adaae0c0c6dfb8de2 *src/dup.c e89fa490ca241429f9f7adbea3b931de *src/dupLen.c 5eaee76c99ff42679577592ae9c5a29f *src/fpos.c 2a47a4eb3de647b3d2e21775c95ede42 *src/iif.c @@ -27,11 +27,11 @@ b929f70ab892f155eeead08c160ffc25 *src/kit.h a52426250b954a335b1121948e057ee7 *src/Makevars.in 95e3011e37d9dde0d75f3a3819b2acd3 *src/Makevars.win b13fc207b052914c3d078eb5759cecce *src/nswitch.c -26b7ca31f8c1b87e4d381c5a991daaae *src/psort.c +0f3d02f6281d978ffb89098311aa0305 *src/psort.c 1d70a2f6d6d5821039dd4ba0caab8a68 *src/psum.c 2c6e521b15f59e489cf31a53c1530b60 *src/share.c ef9329d7e748c13b9526fca1788a1891 *src/topn.c 2cde70cd4cbf783f0b01a9dd70c01ac9 *src/utils.c -719ad7753149642df0dd7c0c38c57e28 *src/vswitch.c +746bdc5ecf3683dbdf4bb740e593c9f7 *src/vswitch.c 6af1b66c0c90f6809c960e2133c1b5e4 *tests/test_kit.R 0dce9bd953fe40b1c8fae3d01a597e7c *tests/test_kit.Rout.save diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index e9bf293..1ccff58 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -4,7 +4,7 @@ \newcommand{\CRANpkg}{\href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}} -\section{version 0.0.17 (2024-04-25)}{ +\section{version 0.0.17 (2024-05-03)}{ \subsection{Bug Fixes}{ \itemize{ \item Fix \code{nswitch}. Thanks to Sebastian Krantz for raising an issue. @@ -13,6 +13,8 @@ \subsection{Notes}{ \itemize{ \item Update copyright date in c files + + \item Fix note on CRAN regarding SETLENGTH } } } diff --git a/src/dup.c b/src/dup.c index d6c8ef2..f15eeb4 100644 --- a/src/dup.c +++ b/src/dup.c @@ -847,7 +847,8 @@ SEXP dupVecR(SEXP x, SEXP uniq, SEXP fromLast) { } } if (j != len) { - SETLENGTH(ans, j); + ans = Rf_xlengthgets(ans, j); + copyMostAttrib(x, ans); } } Free(count); @@ -892,7 +893,8 @@ SEXP dupVecR(SEXP x, SEXP uniq, SEXP fromLast) { } } if (j != 3) { - SETLENGTH(ans, j); + ans = Rf_xlengthgets(ans, j); + copyMostAttrib(x, ans); } } Free(count); diff --git a/src/psort.c b/src/psort.c index e6083f4..a5a4804 100644 --- a/src/psort.c +++ b/src/psort.c @@ -452,7 +452,7 @@ SEXP cpsortR (SEXP x, SEXP decreasing, SEXP nthread, SEXP nalast, SEXP env, SEXP } } if (ct > 0) { - SETLENGTH(valSorted, nlen-ct); + valSorted = Rf_xlengthgets(valSorted, nlen-ct); } } UNPROTECT(2); @@ -513,7 +513,7 @@ SEXP cpsortR (SEXP x, SEXP decreasing, SEXP nthread, SEXP nalast, SEXP env, SEXP } } if (ct > 0) { - SETLENGTH(ans, xlen-ct); + ans = Rf_xlengthgets(ans, xlen-ct); } } } else {*/ @@ -531,7 +531,10 @@ SEXP cpsortR (SEXP x, SEXP decreasing, SEXP nthread, SEXP nalast, SEXP env, SEXP } } if (ct > 0) { - SETLENGTH(ans, xlen-ct); + ans = Rf_xlengthgets(ans, xlen-ct); + if (!cindex) { + copyMostAttrib(x, ans); + } } } //} @@ -610,7 +613,7 @@ SEXP charToFactR (SEXP x, SEXP decreasing, SEXP nthread, SEXP nalast, SEXP env, free(lookupTable); if (addNAv == 0) { - SETLENGTH(valSorted, LENGTH(valSorted)-1); + valSorted = Rf_xlengthgets(valSorted, LENGTH(valSorted)-1); } setAttrib(ans, R_LevelsSymbol, valSorted); SEXP classV = PROTECT(allocVector(STRSXP,1));