- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
The R Book Tables精选
6
Tables
The alternative to using graphics is to summarize your data in tabular form. Broadly speaking, if you want
to convey detail use a table, and if you want to show effects then use graphics. You are more likely to want
to use a table to summarize data when your explanatory variables are categorical (such as people’s names,
or different commodities) than when they are continuous (in which case a scatterplot is likely to be more
informative; see p. 189).
There are two very important functions that you need to distinguish:
table for counting things;
tapply for averaging things, and applying other functions across factor levels.
6.1 Tables of counts
The table function is perhaps the most useful of all the simple vector functions, because it does so much
work behind the scenes. We have a vector of objects (they could be numbers or character strings) and we
want to know how many of each is present in the vector. Here are 1000 integers from a Poisson distribution
with mean 0.6:
counts-rpois(1000,0.6)
We want to count up all of the zeros, ones, twos, and so on. A big task, but here is the table function in
action:
table(counts)
counts
0 1 2 3 4 5
539 325 110 24 1 1
There were 539 zeros, 325 ones, 110 twos, 24 threes, 1 four, 1 five and nothing larger than 5. That is a lot of
work (imagine tallying them for yourself). The function works for characters as well as for numbers, and for
The R Book, Second Edition. Michael J. Crawley.
© 2013 John Wiley Sons, Ltd. Published 2013 by John Wiley Sons, Ltd.
TABLES 245
multiple classifying variables:
infections-read.table(c:\\temp\\disease.txt,header=T)
您可能关注的文档
- succession and failure精选.pdf
- surviving the boss from hell精选.pdf
- Sulfated polymannuroguluronate (SPMG), a novel anti-acquired immune deficiency syndrome精选.pdf
- Swaps Caps Floors and Swaptions精选.pdf
- Symmetric Hilbert Spaces and Related Topics01-front-matter精选.pdf
- SVC阀基电子及晶闸管高电位控制系统的研究精选.pdf
- SVG技术在城市轨道交通领域的应用研究精选.pdf
- SYD - K2 SmartObjects - Fundamentals.LABS精选.pdf
- SVC监控系统的研究及其应用精选.pdf
- take the money or run精选.pdf
- The R Book Tree Models精选.pdf
- The Relation of Wave and Particle Viewpoint精选.pdf
- The Relation between Unemployment and the Rate of Change of Money Wage Rates in the United Kingdom, 1861-1957精选.pdf
- The Rise of Middle Kingdoms Emerging Economies in Global Trade精选.pdf
- The Role of Religion in Household Finance精选.pdf
- The Role of Risk in Consumer Behavior精选.pdf
- THE SECOND MOMENT精选.pdf
- the shakedown精选.pdf
- the skeleton in the corporate closet精选.pdf
- the sputtering r&d machine精选.pdf
文档评论(0)