The R Project SVN R

Rev

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

Rev 84211 Rev 87891
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) 1995, 1996  Robert Gentleman and Ross Ihaka
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 2006-2016 The R Core Team
4
 *  Copyright (C) 2006-2025 The R Core Team
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
Line 27... Line 27...
27
#include <R_ext/Itermacros.h>
27
#include <R_ext/Itermacros.h>
28
 
28
 
29
attribute_hidden SEXP do_split(SEXP call, SEXP op, SEXP args, SEXP env)
29
attribute_hidden SEXP do_split(SEXP call, SEXP op, SEXP args, SEXP env)
30
{
30
{
31
    SEXP x, f, counts, vec, nm, nmj;
31
    SEXP x, f, counts, vec, nm, nmj;
32
    Rboolean have_names;
-
 
33
 
32
 
34
    checkArity(op, args);
33
    checkArity(op, args);
35
 
34
 
36
    x = CAR(args);
35
    x = CAR(args);
37
    f = CADR(args);
36
    f = CADR(args);
Line 45... Line 44...
45
    if (nfac <= 0 && nobs > 0)
44
    if (nfac <= 0 && nobs > 0)
46
	error(_("group length is 0 but data length > 0"));
45
	error(_("group length is 0 but data length > 0"));
47
    if (nfac > 0 && (nobs % nfac) != 0)
46
    if (nfac > 0 && (nobs % nfac) != 0)
48
	warning(_("data length is not a multiple of split variable"));
47
	warning(_("data length is not a multiple of split variable"));
49
    nm = getAttrib(x, R_NamesSymbol);
48
    nm = getAttrib(x, R_NamesSymbol);
50
    have_names = nm != R_NilValue;
49
    bool have_names = nm != R_NilValue;  // used in split-incl.c
51
 
50
 
52
#ifdef LONG_VECTOR_SUPPORT
51
#ifdef LONG_VECTOR_SUPPORT
53
    if (IS_LONG_VEC(x))
52
    if (IS_LONG_VEC(x))
54
# define _L_INTSXP_ REALSXP
53
# define _L_INTSXP_ REALSXP
55
# define _L_INTEG_  REAL
54
# define _L_INTEG_  REAL