转载请注明出处:http://www.cnblogs.com/lizichao/p/4800513.html

词汇表

  想要玩得转R,重要的一点是有一个好的工作词汇表。以下是我认为的一个好的词汇表。你不必熟悉每个函数的细节,但是你应该知道它们的存在。如果词汇表中的函数你没有听说过,我强烈建议你阅读下相关文档。

  我阅读了base包、stats包、untils包所有的函数,并提取了我认为最重要的函数,组成了下列的词汇表。列表中也有一些其他包中的重要函数,而且还有一些更加重要的,比如options()。

基本函数

  1. # The first functions to learn
  2. ?
  3. str
  4.  
  5. # Important operators and assignment
  6. %in%, match
  7. =, <-, <<-
  8. $, [, [[, head, tail, subset
  9. with
  10. assign, get
  11.  
  12. # Comparison
  13. all.equal, identical
  14. !=, ==, >, >=, <, <=
  15. is.na, complete.cases
  16. is.finite
  17.  
  18. # Basic math
  19. *, +, -, /, ^, %%, %/%
  20. abs, sign
  21. acos, asin, atan, atan2
  22. sin, cos, tan
  23. ceiling, floor, round, trunc, signif
  24. exp, log, log10, log2, sqrt
  25.  
  26. max, min, prod, sum
  27. cummax, cummin, cumprod, cumsum, diff
  28. pmax, pmin
  29. range
  30. mean, median, cor, sd, var
  31. rle
  32.  
  33. # Functions to do with functions
  34. function
  35. missing
  36. on.exit
  37. return, invisible
  38.  
  39. # Logical & sets
  40. &, |, !, xor
  41. all, any
  42. intersect, union, setdiff, setequal
  43. which
  44.  
  45. # Vectors and matrices
  46. c, matrix
  47. # automatic coercion rules character > numeric > logical
  48. length, dim, ncol, nrow
  49. cbind, rbind
  50. names, colnames, rownames
  51. t
  52. diag
  53. sweep
  54. as.matrix, data.matrix
  55.  
  56. # Making vectors
  57. c
  58. rep, rep_len
  59. seq, seq_len, seq_along
  60. rev
  61. sample
  62. choose, factorial, combn
  63. (is/as).(character/numeric/logical/...)
  64.  
  65. # Lists & data.frames
  66. list, unlist
  67. data.frame, as.data.frame
  68. split
  69. expand.grid
  70.  
  71. # Control flow
  72. if, &&, || (short circuiting)
  73. for, while
  74. next, break
  75. switch
  76. ifelse
  77.  
  78. # Apply & friends
  79. lapply, sapply, vapply
  80. apply
  81. tapply
  82. replicate

常见数据结构相关函数

  1. # Date time
  2. ISOdate, ISOdatetime, strftime, strptime, date
  3. difftime
  4. julian, months, quarters, weekdays
  5. library(lubridate)
  6.  
  7. # Character manipulation
  8. grep, agrep
  9. gsub
  10. strsplit
  11. chartr
  12. nchar
  13. tolower, toupper
  14. substr
  15. paste
  16. library(stringr)
  17.  
  18. # Factors
  19. factor, levels, nlevels
  20. reorder, relevel
  21. cut, findInterval
  22. interaction
  23. options(stringsAsFactors = FALSE)
  24.  
  25. # Array manipulation
  26. array
  27. dim
  28. dimnames
  29. aperm
  30. library(abind)

统计函数

  1. # Ordering and tabulating
  2. duplicated, unique
  3. merge
  4. order, rank, quantile
  5. sort
  6. table, ftable
  7.  
  8. # Linear models
  9. fitted, predict, resid, rstandard
  10. lm, glm
  11. hat, influence.measures
  12. logLik, df, deviance
  13. formula, ~, I
  14. anova, coef, confint, vcov
  15. contrasts
  16.  
  17. # Miscellaneous tests
  18. apropos("\\.test$")
  19.  
  20. # Random variables
  21. (q, p, d, r) * (beta, binom, cauchy, chisq, exp, f, gamma, geom,
  22. hyper, lnorm, logis, multinom, nbinom, norm, pois, signrank, t,
  23. unif, weibull, wilcox, birthday, tukey)
  24.  
  25. # Matrix algebra
  26. crossprod, tcrossprod
  27. eigen, qr, svd
  28. %*%, %o%, outer
  29. rcond
  30. solve

使用R

  1. # Workspace
  2. ls, exists, rm
  3. getwd, setwd
  4. q
  5. source
  6. install.packages, library, require
  7.  
  8. # Help
  9. help, ?
  10. help.search
  11. apropos
  12. RSiteSearch
  13. citation
  14. demo
  15. example
  16. vignette
  17.  
  18. # Debugging
  19. traceback
  20. browser
  21. recover
  22. options(error = )
  23. stop, warning, message
  24. tryCatch, try

输入/输出

  1. # Output
  2. print, cat
  3. message, warning
  4. dput
  5. format
  6. sink, capture.output
  7.  
  8. # Reading and writing data
  9. data
  10. count.fields
  11. read.csv, write.csv
  12. read.delim, write.delim
  13. read.fwf
  14. readLines, writeLines
  15. readRDS, saveRDS
  16. load, save
  17. library(foreign)
  18.  
  19. # Files and directories
  20. dir
  21. basename, dirname, tools::file_ext
  22. file.path
  23. path.expand, normalizePath
  24. file.choose
  25. file.copy, file.create, file.remove, file.rename, dir.create
  26. file.exists, file.info
  27. tempdir, tempfile
  28. download.file, library(downloader)

Advanced R之词汇表的更多相关文章

  1. Advanced R之函数

    转载请注明出处,谢谢. 再次声明下,本人水平有些,错误之处敬请指正. 函数 函数是R基本的块结构单元:为了掌握本书中的更高级技术,你需要对函数有扎实的了解.也许你已经写过一些函数,并了解函数的基本知识 ...

  2. C++ 词汇表

    C++词汇表 A abort()                       特殊函数 如果一个函数抛出异常,但在通往异常函数的调用链中找不到与之匹配的catch,则该程序通常以此函数调用终止 abs ...

  3. Transformers 词汇表 | 二

    作者|huggingface 编译|VK 来源|Github 词汇表每种模型都不同,但与其他模型相似.因此,大多数模型使用相同的输入,此处将在用法示例中进行详细说明. 输入ID 输入id通常是传递给模 ...

  4. Paip.语义分析----情绪情感词汇表总结

    Paip.语义分析----情绪情感词汇表总结 以下词语是按感情色彩共分为十四类: 作者Attilax  艾龙,  EMAIL:1466519819@qq.com  来源:attilax的专栏 地址:h ...

  5. CSS Vocabulary – CSS 词汇表,你都掌握了吗?

    CSS 是前端开发必备技能,入门容易,深入难.比如像 Pseudo-class.Pseudo-element.Media query.Media type 以及 Vendor prefix 的概念,很 ...

  6. .Net词汇表中常见缩略语汇总

    .Net中存在大量的专业词汇(详细列表,请参考:Visual Studio 和 .NET Framework 词汇表),其中很多词汇常常采用缩略语的形式被大量使用. 在阅读.Net书籍或网络资料时,便 ...

  7. USD词汇表(USD Glossary)

    这篇文章是在学习USD的过程中龟速写成的,目的是将USD的核心设计.相关概念的说明.以及配套API整理出来,为后续进行的USD开发工作提供中文资料支持. 实际上也只有充分理解了USD设计中的每一个知识 ...

  8. 腾讯互动课堂(Tencent Interact Class,TIC)SDK 词汇表

    词汇表 https://cloud.tencent.com/document/product/266/11732 封装格式 封装格式(Format)是将已经编码压缩好的视频流和音频流按照一定的格式规范 ...

  9. IT词汇表

    本人采集到了数十万篇中文技术类博客,进行分词后根据出现的词频手工整理了一份IT词汇表,共计12000个,基本囊括了常见的中英文IT词汇,欢迎各位提出交流意见. 点此 下载

随机推荐

  1. XMPP资源绑定(Resource Binding)

    一个XMPP的账号由三部分组成: 用户名(user/node),域名(domain)和资源(resource) .例如 alice@xmpp.irusher.com/mobile ,user部分(或n ...

  2. ios -- 极光推送《2》--极光推送消息推送成功,但是手机收不到的解决方法

    1.确认证书是否与app的Bundle ID是否一致 2. 确认你的推送证书是否已经过期 3.确认你的APP_KEY是否和极光APP_KEY是否一致 4.正确调用bindChannel,并成功返回ap ...

  3. VS中Component Class、User Control及Custom Control的区别 .

    .NET Framework 为您提供了开发和实现新控件的能力.除了常见的用户控件外,现在您会发现,您可以编写能执行自身绘图的自定义控件,甚至还可以通过继承扩展现有控件的功能.确定创建何种类型的控件可 ...

  4. 错误记录--更改tomcat端口号方法,Several ports (8005, 8080, 8009)【转】

    启动Tomcat服务器报错: Several ports (8005, 8080, 8009) required by Tomcat v5.5 Server at localhost are alre ...

  5. Webpack探索【10】--- 懒加载详解

    本文主要讲懒加载方面相关内容.

  6. 【JAVA学习】struts2的action中使用session的方法

    尊重版权:http://hi.baidu.com/dillisbest/item/0bdc35c0b477b853ad00efac 在Struts2里,假设须要在Action中使用session.能够 ...

  7. Ceph集群rbd-mirror A、B区域备份实施方案

    Ceph集群rbd-mirror A.B区域备份实施方案 备注:首先准备两个集群, 并确认其状态,集群的准备过程在这就不做陈述 1.查看集群状态 A区域 [root@ceph2111 ceph]# c ...

  8. Spring Boot 支持多种外部配置方式

    Spring Boot 支持多种外部配置方式 http://blog.csdn.net/isea533/article/details/50281151 这些方式优先级如下: 命令行参数 来自java ...

  9. (转)source insight 窗口嵌入

    昨天用了一下source insight ,都说很强大,也有感觉,但是这个强大的东西往往不是那么容易弄清楚的,或者一下子就好上手的,工具强大,功能复杂多样,一开始不知道怎么入手,以后慢慢来吧,学习是要 ...

  10. 在maven 中部署SSM项目找不 Spring ContextLoaderListener 的解决办法

    1.项目使用技术:maven的项目使用了Spring MVC+Spring +Mybatis+Tomcat搭建一个项目. 2.报错信息: Error configuring application l ...