| Line 95... |
Line 95... |
| 95 |
dimnames = CAR(args);
|
95 |
dimnames = CAR(args);
|
| 96 |
args = CDR(args);
|
96 |
args = CDR(args);
|
| 97 |
miss_nr = asLogical(CAR(args)); args = CDR(args);
|
97 |
miss_nr = asLogical(CAR(args)); args = CDR(args);
|
| 98 |
miss_nc = asLogical(CAR(args));
|
98 |
miss_nc = asLogical(CAR(args));
|
| 99 |
|
99 |
|
| - |
|
100 |
static int nowarn = -1;
|
| - |
|
101 |
if (nowarn == -1) {
|
| - |
|
102 |
char *p = getenv("_R_CHECK_MATRIX_DATA_");
|
| - |
|
103 |
nowarn = (p && StringTrue(p)) ? 1 : 0;
|
| - |
|
104 |
}
|
| 100 |
if (!miss_nr) {
|
105 |
if (!miss_nr) {
|
| 101 |
if (!isNumeric(snr)) error(_("non-numeric matrix extent"));
|
106 |
if (!isNumeric(snr)) error(_("non-numeric matrix extent"));
|
| 102 |
nr = asInteger(snr);
|
107 |
nr = asInteger(snr);
|
| 103 |
if (nr == NA_INTEGER)
|
108 |
if (nr == NA_INTEGER)
|
| 104 |
error(_("invalid 'nrow' value (too large or NA)"));
|
109 |
error(_("invalid 'nrow' value (too large or NA)"));
|
| Line 137... |
Line 142... |
| 137 |
((lendat < nr) && (nr / lendat) * lendat != nr))
|
142 |
((lendat < nr) && (nr / lendat) * lendat != nr))
|
| 138 |
warning(_("data length [%d] is not a sub-multiple or multiple of the number of rows [%d]"), lendat, nr);
|
143 |
warning(_("data length [%d] is not a sub-multiple or multiple of the number of rows [%d]"), lendat, nr);
|
| 139 |
else if (((lendat > nc) && (lendat / nc) * nc != lendat) ||
|
144 |
else if (((lendat > nc) && (lendat / nc) * nc != lendat) ||
|
| 140 |
((lendat < nc) && (nc / lendat) * lendat != nc))
|
145 |
((lendat < nc) && (nc / lendat) * lendat != nc))
|
| 141 |
warning(_("data length [%d] is not a sub-multiple or multiple of the number of columns [%d]"), lendat, nc);
|
146 |
warning(_("data length [%d] is not a sub-multiple or multiple of the number of columns [%d]"), lendat, nc);
|
| 142 |
else if (nrc != lendat)
|
147 |
else if (nrc != lendat) {
|
| - |
|
148 |
if(nowarn)
|
| - |
|
149 |
error(_("data length differs from size of matrix: [%d != %d x %d]"), lendat, nr, nc);
|
| - |
|
150 |
else
|
| 143 |
warning(_("data length differs from size of matrix: [%d != %d x %d]"), lendat, nr, nc);
|
151 |
warning(_("data length differs from size of matrix: [%d != %d x %d]"), lendat, nr, nc);
|
| - |
|
152 |
}
|
| 144 |
}
|
153 |
}
|
| 145 |
else if (lendat > 1 && nrc == 0) // for now *not* warning for e.g., matrix(NA, 0, 4)
|
154 |
else if (lendat > 1 && nrc == 0) // for now *not* warning for e.g., matrix(NA, 0, 4)
|
| 146 |
warning(_("non-empty data for zero-extent matrix"));
|
155 |
warning(_("non-empty data for zero-extent matrix"));
|
| 147 |
}
|
156 |
}
|
| 148 |
|
157 |
|