Typical data analysis steps:
R Language: Language and environment for statistical calculations and plotting
Data analysis: Statistics, machine learning
Use of R
1. Case-sensitive, interpreted language
2. R Statement Assignment: <-
3. R Comment: #
4. Create vector C ()
5. Watch Demo List demo (), Graphic demo demo (graphics)
6. Help function
7. GETWD () View current working directory, SETWD () set Current working directory
SETWD (' e:\\ ') GETWD () [1] "e:/"
8. Working space management functions
9. Input and output
1). Enter
Source (' filename ') executes a script in the current session
2). Text output
Sink (' filename ') output redirected to file filename, append=true append file
3). Graphics output
4). Dev.off () output back to Terminal
#在当前会话中执行脚本source ("script1. R ") #文本输出 [append] to Myoutput, the graphic output is saved to Mygraphs.pdfsink (" Myoutput ", Append=true, split= TRUE) in PDF (" Mygraphs.pdf ") Source (" Script2. R ") #sink () #结果返回到终端dev. Off () source (" Script3. R ")
10. Package Management
#安装ggplot2包install. Packages ("Ggplot2") #更新ggplot2包update. Packages ("Ggplot2") #载入包library (Ggplot2) #查看已加载包 (. Packages ()) #卸除包detach ("Package:ggplot2") #卸载包remove. Packages ("Ggplot2")
[Reading notes] R language Combat (i) Introduction to the R language