Upcoming SlideShare
×

# Reading Data into R REVISED

33,258

Published on

Published in: Education
2 Likes
Statistics
Notes
• Full Name
Comment goes here.

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

Views
Total Views
33,258
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
49
0
Likes
2
Embeds 0
No embeds

No notes for slide
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• ### Reading Data into R REVISED

1. 1. Reading data into REVISED 2012-10-05@HSPH Kazuki Yoshida, M.D. MPH-CLE student FREEDOM TO  KNOW
2. 2. Previously in this groupn Introduction to Rn Reading Data into R (1) Group Website: http://rpubs.com/kaz_yos/useR_at_HSPH
4. 4. Ingredients Statistics Programmingn None n Install/Load packages n read.____() functions n <- (assignment)
5. 5. http://mediacrushllc.com/2012/internet-statistics-2012/ is the study of thecollection, organization, analysis, interpretation, and presentation of data http://en.wikipedia.org/wiki/Statistics
6. 6. Supportedn .RData (native): load()n .csv & text ﬁles: read.csv(), etcn .xls/.xlsx: library(gdata) or library(xlsx)n .sas7bdat: read.sas7bdat() via library(sas7bdat)n .dta: read.dta via library(foreign)n and more... http://cran.r-project.org/doc/manuals/R-data.html
7. 7. Create a folder for this study group This will be your working directory.
8. 8. Firstconﬁgure Studio
9. 9. OpenR Studio
10. 10. WorkspaceConsole Plot
11. 11. Tools-Options
12. 12. Restart RStudioafter coﬁguration
13. 13. Working directory? Folder your are working in
14. 14. CRANmirror
15. 15. Comprehensive R You get additional Archive functionalities from here! Networkhttp://cran.r-project.org/web/packages/ available_packages_by_date.html
16. 16. Createa script
17. 17. Source WorkspaceConsole Plot
19. 19. Install packages! foreign sas7bdat XML gdata xlsx
21. 21. Use text ﬁlesuch as csv if possible
23. 23. For comma-, tab-, orspace-separated text, GUI is available
24. 24. Text
25. 25. name of a dataset here ﬁle name herebone <- read.csv(“BONEDEN.DAT.txt”) function to read .csv ﬁles
26. 26. Excel next
27. 27. Use gdata package library(gdata)bone <- read.xls(“BONEDEN.DAT.xls”)
28. 28. Use xlsx package library(xlsx)bone <- read.xlsx(“BONEDEN.DAT.xls”, sheetIndex = 1)
29. 29. Never type all Always hit TAB http://www.clickykeyboards.com/index.cfm/fa/ items.main/parentcat/10191/subcatid/0/id/179764
30. 30. Never type all F1 for help Always hit TAB http://www.clickykeyboards.com/index.cfm/fa/ items.main/parentcat/10191/subcatid/0/id/179764