[EMAIL PROTECTED] wrote:
Full_Name: Hin-Tak Leung
Version: R 2.2.1
OS: x86_64-redhat-linux-gnu
Submission from: (NULL) (131.111.186.92)
rbind/cbind is unimplemented for raw (RAWSXP) types.
I have a working patch implementing the functionality,
to follow.
Attached in ready-to-patch form and also insert (white spaces
will go wrong) here. Please review, comment and possibly commit,
and hope to see it in R 2.3.x
====================
--- src/main/bind.c.orig 2005-10-06 11:25:22.000000000 +0100
+++ src/main/bind.c 2006-01-27 11:55:32.000000000 +0000
@@ -997,6 +997,7 @@
case CPLXSXP:
case STRSXP:
case VECSXP:
+ case RAWSXP:
break;
/* we don't handle expressions: we could, but coercion of a matrix
to an expression is not ideal */
@@ -1164,6 +1165,18 @@
}
}
}
+ else if (mode == RAWSXP) {
+ for (t = args; t != R_NilValue; t = CDR(t)) {
+ u = PRVALUE(CAR(t));
+ if (isMatrix(u) || length(u) >= lenmin) {
+ u = coerceVector(u, RAWSXP);
+ k = LENGTH(u);
+ idx = (!isMatrix(u)) ? rows : k;
+ for (i = 0; i < idx; i++)
+ RAW(result)[n++] = RAW(u)[i % k];
+ }
+ }
+ }
else {
for (t = args; t != R_NilValue; t = CDR(t)) {
u = PRVALUE(CAR(t));
@@ -1385,6 +1398,21 @@
}
}
}
+ else if (mode == RAWSXP) {
+ for (t = args; t != R_NilValue; t = CDR(t)) {
+ u = PRVALUE(CAR(t));
+ if (isMatrix(u) || length(u) >= lenmin) {
+ u = coerceVector(u, RAWSXP);
+ k = LENGTH(u);
+ idx = (isMatrix(u)) ? nrows(u) : (k > 0);
+ for (i = 0; i < idx; i++)
+ for (j = 0; j < cols; j++)
+ RAW(result)[i + n + (j * rows)]
+ = RAW(u)[(i + j * idx) % k];
+ n += idx;
+ }
+ }
+ }
else {
for (t = args; t != R_NilValue; t = CDR(t)) {
u = PRVALUE(CAR(t));
================================
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel