| Line 1... |
Line 1... |
| 1 |
/*
|
1 |
/*
|
| 2 |
* R : A Computer Language for Statistical Data Analysis
|
2 |
* R : A Computer Language for Statistical Data Analysis
|
| 3 |
* Copyright (C) 1998-2019 The R Core Team
|
3 |
* Copyright (C) 1998-2020 The R Core Team
|
| 4 |
* Copyright (C) 2002-2015 The R Foundation
|
4 |
* Copyright (C) 2002-2015 The R Foundation
|
| 5 |
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
|
5 |
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
|
| 6 |
*
|
6 |
*
|
| 7 |
* This program is free software; you can redistribute it and/or modify
|
7 |
* This program is free software; you can redistribute it and/or modify
|
| 8 |
* it under the terms of the GNU General Public License as published by
|
8 |
* it under the terms of the GNU General Public License as published by
|
| Line 360... |
Line 360... |
| 360 |
PROTECT(newdims = allocVector(INTSXP, n));
|
360 |
PROTECT(newdims = allocVector(INTSXP, n));
|
| 361 |
for (i = 0, n = 0; i < ndims; i++)
|
361 |
for (i = 0, n = 0; i < ndims; i++)
|
| 362 |
if (dim[i] != 1)
|
362 |
if (dim[i] != 1)
|
| 363 |
INTEGER(newdims)[n++] = dim[i];
|
363 |
INTEGER(newdims)[n++] = dim[i];
|
| 364 |
if(!isNull(getAttrib(dims, R_NamesSymbol))) {
|
364 |
if(!isNull(getAttrib(dims, R_NamesSymbol))) {
|
| 365 |
SEXP nms_d = getAttrib(dims, R_NamesSymbol),
|
365 |
SEXP new_nms = PROTECT(allocVector(STRSXP, n));
|
| 366 |
new_nms = PROTECT(allocVector(STRSXP, n));
|
366 |
SEXP nms_d = getAttrib(dims, R_NamesSymbol);
|
| 367 |
for (i = 0, n = 0; i < ndims; i++)
|
367 |
for (i = 0, n = 0; i < ndims; i++)
|
| 368 |
if (dim[i] != 1)
|
368 |
if (dim[i] != 1)
|
| 369 |
SET_STRING_ELT(new_nms, n++, STRING_ELT(nms_d, i));
|
369 |
SET_STRING_ELT(new_nms, n++, STRING_ELT(nms_d, i));
|
| 370 |
setAttrib(newdims, R_NamesSymbol, new_nms);
|
370 |
setAttrib(newdims, R_NamesSymbol, new_nms);
|
| 371 |
UNPROTECT(1);
|
371 |
UNPROTECT(1);
|