The R Project SVN R

Rev

Rev 33256 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33256 Rev 33297
Line 1145... Line 1145...
1145
	return object;
1145
	return object;
1146
    }
1146
    }
1147
    else return object;
1147
    else return object;
1148
 
1148
 
1149
 badformula:
1149
 badformula:
1150
    error(_("invalid formula in update"));
1150
    error(_("invalid formula in 'update'"));
1151
    return R_NilValue; /*NOTREACHED*/
1151
    return R_NilValue; /*NOTREACHED*/
1152
}
1152
}
1153
 
1153
 
1154
SEXP do_updateform(SEXP call, SEXP op, SEXP args, SEXP rho)
1154
SEXP do_updateform(SEXP call, SEXP op, SEXP args, SEXP rho)
1155
{
1155
{
Line 1305... Line 1305...
1305
    }
1305
    }
1306
    for (i = 0,j = 0; i < ndots; i++) {
1306
    for (i = 0,j = 0; i < ndots; i++) {
1307
	if (VECTOR_ELT(dots, i) == R_NilValue)
1307
	if (VECTOR_ELT(dots, i) == R_NilValue)
1308
	    continue;
1308
	    continue;
1309
	if(strlen(CHAR(STRING_ELT(dotnames, i))) + 3 > 256)
1309
	if(strlen(CHAR(STRING_ELT(dotnames, i))) + 3 > 256)
1310
	    error(_("overlong names in %s"), CHAR(STRING_ELT(dotnames, i)));
1310
	    error(_("overlong names in '%s'"), CHAR(STRING_ELT(dotnames, i)));
1311
	sprintf(buf, "(%s)", CHAR(STRING_ELT(dotnames, i)));
1311
	sprintf(buf, "(%s)", CHAR(STRING_ELT(dotnames, i)));
1312
	SET_VECTOR_ELT(data, nvars + j, VECTOR_ELT(dots, i));
1312
	SET_VECTOR_ELT(data, nvars + j, VECTOR_ELT(dots, i));
1313
	SET_STRING_ELT(names, nvars + j,  mkChar(buf));
1313
	SET_STRING_ELT(names, nvars + j,  mkChar(buf));
1314
	j++;
1314
	j++;
1315
    }
1315
    }
Line 1554... Line 1554...
1554
    }
1554
    }
1555
    else if (isInteger(factors) && isMatrix(factors)) {
1555
    else if (isInteger(factors) && isMatrix(factors)) {
1556
	nVar = nrows(factors);
1556
	nVar = nrows(factors);
1557
	nterms = ncols(factors);
1557
	nterms = ncols(factors);
1558
    }
1558
    }
1559
    else errorcall(call, _("invalid terms argument"));
1559
    else errorcall(call, _("invalid 'terms' argument"));
1560
 
1560
 
1561
    /* Get the variable names from the factor matrix */
1561
    /* Get the variable names from the factor matrix */
1562
 
1562
 
1563
    vnames = getAttrib(factors, R_DimNamesSymbol);
1563
    vnames = getAttrib(factors, R_DimNamesSymbol);
1564
    if (length(factors) > 0) {
1564
    if (length(factors) > 0) {
1565
	if (length(vnames) < 1 ||
1565
	if (length(vnames) < 1 ||
1566
	    (nVar - intrcept > 0 && !isString(VECTOR_ELT(vnames, 0))))
1566
	    (nVar - intrcept > 0 && !isString(VECTOR_ELT(vnames, 0))))
1567
	    errorcall(call, _("invalid terms argument"));
1567
	    errorcall(call, _("invalid 'terms' argument"));
1568
	vnames = VECTOR_ELT(vnames, 0);
1568
	vnames = VECTOR_ELT(vnames, 0);
1569
    }
1569
    }
1570
 
1570
 
1571
    /* Get the variables from the model frame.  First perform */
1571
    /* Get the variables from the model frame.  First perform */
1572
    /* elementary sanity checks.  Notes:  1) We need at least */
1572
    /* elementary sanity checks.  Notes:  1) We need at least */
Line 1716... Line 1716...
1716
	nc = 1;
1716
	nc = 1;
1717
    else
1717
    else
1718
	nc = 0;
1718
	nc = 0;
1719
    for (j = 0; j < nterms; j++) {
1719
    for (j = 0; j < nterms; j++) {
1720
	if (j == rhs_response) {
1720
	if (j == rhs_response) {
1721
	    warning(_("the response appeared on the rhs and was dropped"));
1721
	    warning(_("the response appeared on the right-hand side and was dropped"));
1722
	    INTEGER(count)[j] = 0;  /* need this initialised */
1722
	    INTEGER(count)[j] = 0;  /* need this initialised */
1723
	    continue;
1723
	    continue;
1724
	}
1724
	}
1725
	k = 1;
1725
	k = 1;
1726
	for (i = 0; i < nVar; i++) {
1726
	for (i = 0; i < nVar; i++) {