45 R_xlen_t length = XLENGTH(x);
46 SEXP ans = Rf_allocVector(type, length);
49 memcpy( RAW(ans), RAW(x),
sizeof( Rbyte) * (
size_t) length);
52 memcpy(LOGICAL(ans), LOGICAL(x),
sizeof(
int) * (
size_t) length);
55 memcpy(INTEGER(ans), INTEGER(x),
sizeof(
int) * (
size_t) length);
58 memcpy( REAL(ans), REAL(x),
sizeof(
double) * (
size_t) length);
61 memcpy(COMPLEX(ans), COMPLEX(x),
sizeof(Rcomplex) * (
size_t) length);
96 SEXP ans = Rf_allocVector(type, length);
101 Rbyte *pans = RAW(ans);
102 for (i = 0; i < length; ++i)
108 int *pans = LOGICAL(ans);
109 for (i = 0; i < length; ++i)
115 int *pans = INTEGER(ans);
116 for (i = 0; i < length; ++i)
122 double *pans = REAL(ans);
123 for (i = 0; i < length; ++i)
129 Rcomplex *pans = COMPLEX(ans);
130 Rcomplex u; u.r = 1.0; u.i = 0.0;
131 for (i = 0; i < length; ++i)
153 R_xlen_t i, length = XLENGTH(x);
157 int *px = LOGICAL(x);
158 for (i = 0; i < length; ++i) {
159 if (*px == NA_LOGICAL)
167 int *px = INTEGER(x);
168 for (i = 0; i < length; ++i) {
169 if (*px == NA_INTEGER)
177 double *px = REAL(x);
178 for (i = 0; i < length; ++i) {
187 Rcomplex *px = COMPLEX(x);
188 Rcomplex u; u.r = 1.0; u.i = 0.0;
189 for (i = 0; i < length; ++i) {
190 if (ISNAN((*px).r) || ISNAN((*px).i))