[Xts-commits] r644 - pkg/xts/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jun 19 23:43:11 CEST 2012
Author: bodanker
Date: 2012-06-19 23:43:11 +0200 (Tue, 19 Jun 2012)
New Revision: 644
Modified:
pkg/xts/src/isXts.c
Log:
- isXts now also checks for index attribute
Modified: pkg/xts/src/isXts.c
===================================================================
--- pkg/xts/src/isXts.c 2012-06-19 19:42:08 UTC (rev 643)
+++ pkg/xts/src/isXts.c 2012-06-19 21:43:11 UTC (rev 644)
@@ -27,8 +27,9 @@
int isXts(SEXP x)
{
int i;
- SEXP attr;
+ SEXP attr, index;
+ index = getAttrib(x, install("index"));
PROTECT( attr = coerceVector(getAttrib(x, R_ClassSymbol),STRSXP) );
if(length(attr) <= 1) {
UNPROTECT(1);
@@ -37,8 +38,14 @@
for(i = 0; i < length(attr); i++) {
if(STRING_ELT(attr, i) == mkChar("xts")) {
- UNPROTECT(1);
- return 1;
+ /* check for index attribute */
+ if(TYPEOF(index)==REALSXP || TYPEOF(index)==INTSXP) {
+ UNPROTECT(1);
+ return 1;
+ } else {
+ UNPROTECT(1);
+ return 0;
+ }
}
}
UNPROTECT(1);
More information about the Xts-commits
mailing list