The R Project SVN R

Rev

Rev 43007 | Rev 44023 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 43007 Rev 43024
Line 56... Line 56...
56
	return R_NilValue;
56
	return R_NilValue;
57
}
57
}
58
 
58
 
59
SEXP attribute_hidden do_matrix(SEXP call, SEXP op, SEXP args, SEXP rho)
59
SEXP attribute_hidden do_matrix(SEXP call, SEXP op, SEXP args, SEXP rho)
60
{
60
{
61
    SEXP vals, ans, snr, snc, dimnames;
61
    SEXP vals, ans, snr, snc, dimnames = R_NilValue;
62
    int nr, nc, byrow, lendat;
62
    int nr, nc, byrow, lendat,nargs;
63
 
63
 
64
    checkArity(op, args);
64
    checkArity(op, args);
-
 
65
    nargs = length(args);
-
 
66
    if(nargs < 4 || nargs > 5)
-
 
67
	error("incorrect number of arguments to 'matrix'");
65
    vals = CAR(args);
68
    vals = CAR(args);
66
    snr = CADR(args);
69
    snr = CADR(args);
67
    snc = CADDR(args);
70
    snc = CADDR(args);
68
    if (!isNumeric(snr) || !isNumeric(snc))
71
    if (!isNumeric(snr) || !isNumeric(snc))
69
	error(_("non-numeric matrix extent"));
72
	error(_("non-numeric matrix extent"));
70
    byrow = asLogical(CADDDR(args));
73
    byrow = asLogical(CADDDR(args));
71
    if (byrow == NA_INTEGER)
74
    if (byrow == NA_INTEGER)
72
	error(_("invalid 'byrow' value"));
75
	error(_("invalid 'byrow' value"));
73
    dimnames = CAD4R(args);
76
    if(nargs == 5) dimnames = CAD4R(args);
74
 
77
 
75
 
78
 
76
    lendat = length(vals);
79
    lendat = length(vals);
77
    nr = asInteger(snr);
80
    nr = asInteger(snr);
78
    if (nr == NA_INTEGER) /* This is < 0 */
81
    if (nr == NA_INTEGER) /* This is < 0 */