[关闭]
@mdjsjdq 2017-03-27T14:27:08.000000Z 字数 2467 阅读 2316

R语言学习笔记

学习


如何安装R语言

  1. 点击下面的链接,进入R语言下载链接
    R语言下载链接
     R语言的Windows版本
  2. 选择对应的R语言版本,这里选择Windows版本
  3. 下载R语言安装文件

Notes:

安装RStudio开发集成开发环境[IDE]

RStudio欢迎洁面

演示

R语言代码:

  1. # input data
  2. age <-c(3,12,9,3,9,11,2,5,3,1)
  3. weight <-c(6.1,10.2,10.4,6,7.3,8.5,5.2,7.2,5.3,4.4)
  4. # Mean Analysis
  5. mean(age)
  6. mean(weight)
  7. # Standard Deviation
  8. sd(age)
  9. sd(weight)
  10. # Correlation Analysis
  11. cor(age,weight)
  12. # Draw plot
  13. plot(age,weight)

Notes:

最后的界面

最后的结果

点击Run可以运行代码,分析结果

Run分析结果

R 学习资料

  1. R Learning Video
    屏幕快照 2017-03-14 下午12.37.09.png-363.8kB
  2. R in active 电子书

里面的内容很适合初学者快速的去了解R的语法,以及一些关于数据分析的操作。

屏幕快照 2017-03-14 下午12.37.28.png-91kB

Rmarkdown

pandoc: pdflatex not found. pdflatex is needed for pdf output.
错误: pandoc document conversion failed with error 41
停止执行

No TeX installation detected (TeX is required to create PDF output). You should install a recommended TeX distribution for your platform:

Windows: MiKTeX (Complete) - http://miktex.org/2.9/setup
(NOTE: Be sure to download the Complete rather than Basic installation)

Mac OS X: TexLive 2013 (Full) - http://tug.org/mactex/
(NOTE: Download with Safari rather than Chrome strongly recommended)

Linux: Use system package manager

  1. intall.package("rmarkdown")
  2. 或者运行另一个命令
  3. install.packages("rmarkdown", repos = "https://cran.revolutionanalytics.com")

Some RStudio users who have recently downloaded MRO 3.2.3 may encounter an error when they try to create a new R Markdown file from the RStudio IDE. The error informs the user that the available rmarkdown package is not the version required by RStudio. It appears that the rmarkdown package was updated on 1/1/2016 just after the CRAN snapshot was taken that day. Since MRO 3.2.3 uses the 1/1/2016 static CRAN snapshot by default, the fix is as easy as pointing to a more recent version of the package or a more recent repository.

Here’s how. Use ONE of the following solutions:

Get the latest version of the rmarkdown package using
install.packages("rmarkdown", repos = "https://cran.revolutionanalytics.com")
Get the 0.9.2 version of the rmarkdown package using:
install.packages("rmarkdown", repos = "https://mran.revolutionanalytics.com/snapshot/2016-01-02")
Use the R options() function:
options(repos = "https://mran.revolutionanalytics.com/snapshot/2016-01-02")
By default, Microsoft R Open offers its users predictability using a static CRAN snapshot date. For example, the CRAN repository for MRO 3.2.3 is configured to point to a snapshot date of Jan 1, 2016. Consequently, with MRO 3.2.3 you'll always get packages as they were at midnight UTC on Jan 1, 2016 by default whenever you use install.packages. However, as demonstrated above, it is still possible to get packages, such as rmarkdown from another date.

  1. sudo tlmgr update --self
  2. sudo tlmgr install framed
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注