Upcoming SlideShare
×

# R tutorial

82

Published on

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
82
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
3
0
Likes
1
Embeds 0
No embeds

No notes for slide

### R tutorial

1. 1. R Tutorial
2. 2. Basic things to know • You have to get data(there are two ways) – data <- read.csv(file.choose()) – data <- read.table(“clipboard”,header=T) • Notice: this one involves the copy board to restore the data and there should be header for each variables. • You have to save data – write.table(“c:/users/admin/desktop/whatever.csv ”,sep=“,”) • Sep means the way how data are separated.
3. 3. First, you copy them
4. 4. Second, type those codes
5. 5. Third, you can check the data
6. 6. Basic data management • In R you use commands to manage data – data\$V1 • This command will get you to the data and control variable V1 – data[c(1)] • This command will get you to the data and control the first variable. – data[c(1:10)] • This command will get you to the data and control the first to tenth variables.
7. 7. Recode functions • When dealing with data, we may need to recode them from one value to another – For example, you have a variable named Gender, but the values are like “male” and “female”. If you want to do statistical analysis, you may want to recode them into 0 and 1 so that the computer can actually recognize it. • Use the following command – data\$Gender[data\$Gender==“male”] <- 0 – data\$Gender[data\$Gender==“female”] <- 1 • Whatever is inside the [] symbol is the logical conditions.
8. 8. Single tabulation
9. 9. Cross tabulation(frequency)
10. 10. Cross tabulation(sample mean)
11. 11. Three way tabulation
12. 12. Basic Plot(bar)
13. 13. Compare means (T-Test)
14. 14. Compare paired means (T-Test)
15. 15. Correlation
16. 16. Regression(simple)
17. 17. Regression(multiple)
18. 18. THE END
1. #### A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.