[R] How to include "NA" level in table funcion.
Guoqiang Wang
guo52717 at yahoo.com
Mon Jul 16 17:09:45 CEST 2001
Thanks for all your help from R network.
I really feel at home here.
The problem of long string has been solved, by
following the 'paste' suggestion.
Now I have another problem. I try to make a cross
table of the following dataset.
---------------------------------------------
> summary(bor.fac)
cell response resp.mth income
age province
1:4352 0:3122 Min. :0.000 0-31k :1475 0-21
: 2 ON :4064
2:1916 1:3146 1st Qu.:0.000 31k-43k:1562
21-34:1659 BC : 700
Median :1.000 43k-59k:1567
34-41:1568 AB : 459
Mean :1.316 59k-75k: 905
41-49:1438 NS : 303
3rd Qu.:3.000 75k+ : 662 49+
:1601 MB : 297
Max. :6.000 NA's : 97
NB : 180
(Other): 265
tenure acctcnt fundsp
ont
0-0.67 : 16 Min. : 0.000 0-1.5k :1404
0:2204
0.67-1.5 :1645 1st Qu.: 3.000 1.5k-4.4k:1568
1:4064
1.5-1.92 :1775 Median : 3.000 4.4k-10k :1566
1.92-2.33:1218 Mean : 3.169 10k+ :1567
2.33+ :1614 3rd Qu.: 4.000 NA's : 163
Max. :13.000
----------------------------------------
If I use table functions, the level "NA's" in income
and "other" in acctcnt won't appear in the table
regardless of my efforts.
> table(income, response,cell, exclude=(""))
, , cell = 1
response
income 0 1
0-31k 459 585
31k-43k 524 544
43k-59k 553 527
59k-75k 350 290
75k+ 239 201
, , cell = 2
response
income 0 1
0-31k 214 217
31k-43k 242 252
43k-59k 239 248
59k-75k 135 130
75k+ 108 114
> table(income, response,cell, exclude=F)
, , cell = 1
response
income 0 1
0-31k 459 585
31k-43k 524 544
43k-59k 553 527
59k-75k 350 290
75k+ 239 201
, , cell = 2
response
income 0 1
0-31k 214 217
31k-43k 242 252
43k-59k 239 248
59k-75k 135 130
75k+ 108 114
-------------------------------------------------
How can I include "NA" and "other" in the table?
Thanks you so much.
G. Wang, UWO
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list