First, comments
1, check the content to be annotated, shortcut key ctrl+shift+c (uncomment the same method)
2. Enter # before you need to annotate the content
1 #需注释的内容
3, using the IF statement, set the judgment condition to false to skip the content in the IF statement, the equivalent of implementing the content of the comment
1 if (false) 2 {3 5 4 Ten 5 }
Ii. work results preservation, data deletion and loading
1. First create two folders, named Rsourse and data, to save the project file (. r) and the file (. RDA)
2. Related functions:
(1), get current working path: GETWD ()
(2), set the working path: SETWD ()
1 setwd (". \\Rsourse") #相对路径 2 setwd (".. \") #上一级目录 3 setwd ("c:\\users\\wangcj\\onedrive\\ documents\\r-language\\") #绝对路径
(3), folder-related
Determine if a folder exists: File.exists ("Rsourse")
Create folder: Dir.create ("Data")
(4), save
Save work: Save (x,y,file= "Basic.rda") saves X, y to the First.rda file in the current working directory
Save working Space: Save.image ()
(5), delete variable (object): RM (x, y) Delete x, y
(6), download saved value: Load ("Basic.rda")
Third, the basic function of data processing
1, calculate the standard deviation: SD () function
For example, the SD (0:100) asks for a colon between 0 and 100 of the standard deviation {0 and 100 (:) represents an integer from 0 to 100 that is entered into the SD function}
2, calculated average: mean () function
Machine learning and R language--Basic grammar