| 2 |
r |
1 |
/*
|
|
|
2 |
* R : A Computer Langage for Statistical Data Analysis
|
|
|
3 |
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
|
| 4562 |
pd |
4 |
* Copyright (C) 1999 The R Development Core Team
|
| 2 |
r |
5 |
*
|
|
|
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
|
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
|
9 |
* (at your option) any later version.
|
|
|
10 |
*
|
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
14 |
* GNU General Public License for more details.
|
|
|
15 |
*
|
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
|
17 |
* along with this program; if not, write to the Free Software
|
| 5458 |
ripley |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 2 |
r |
19 |
*/
|
|
|
20 |
|
|
|
21 |
/* Factor Tabulation */
|
|
|
22 |
|
| 5288 |
hornik |
23 |
#ifdef HAVE_CONFIG_H
|
| 7701 |
hornik |
24 |
#include <config.h>
|
| 5288 |
hornik |
25 |
#endif
|
|
|
26 |
|
| 19500 |
hornik |
27 |
#include <R_ext/Arith.h>
|
|
|
28 |
#include <R_ext/Applic.h>
|
| 2 |
r |
29 |
|
| 7758 |
ripley |
30 |
void R_tabulate(int *x, int *n, int *nbin, int *ans)
|
| 2486 |
maechler |
31 |
{
|
|
|
32 |
int i;
|
| 4027 |
ripley |
33 |
if(*n < 1) return;
|
|
|
34 |
for(i = 0 ; i < *n ; i++)
|
|
|
35 |
if(x[i] != R_NaInt && x[i] > 0 && x[i] <= *nbin)
|
|
|
36 |
ans[x[i] - 1]++;
|
| 2 |
r |
37 |
}
|