This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
setwd("c:/AGZ1/GD_AGZ1117/AGZ_Home/workspace_R")
list.files()
## [1] "-azhang1-2.Rhistory"
## [2] "-azhang1.Rhistory"
## [3] "-azhang3.Rhistory"
## [4] "2015_03_19 DataKindHackson-azhang1.R"
## [5] "2015_03_19 DataKindHackson.R"
## [6] "BeginningR.html"
## [7] "BeginningR.Rmd"
## [8] "Cell.Rmd"
## [9] "Cell1.html"
## [10] "Cell1.Rmd"
## [11] "Class2Ex_GetStarted.knit.md"
## [12] "Cousera_Duket.R"
## [13] "Cousera_JHU"
## [14] "data"
## [15] "data-wrangling-cheatsheet.pdf"
## [16] "devtools-cheatsheet.pdf"
## [17] "Ebola_Outbreak.csv"
## [18] "genia"
## [19] "git_bitbucket_tutorial"
## [20] "h20.R"
## [21] "Hardy"
## [22] "Lecture2_GettingStartedWith.R"
## [23] "Lecture5_Visualization.R"
## [24] "ML_Homework1.Rmd"
## [25] "myfile"
## [26] "pres1.csv"
## [27] "projects"
## [28] "R in Action.R"
## [29] "README.md"
## [30] "RforRPC.Rmd"
## [31] "RforRPC_files"
## [32] "rmarkdown-cheatsheet.pdf"
## [33] "rmarkdown-reference-guide (1).pdf"
## [34] "Safari"
## [35] "Safari_Jared Lander.R"
## [36] "Safari_Jared Lander.Rmd"
## [37] "Shiny"
## [38] "shiny-cheatsheet.pdf"
## [39] "test-azhang3.R"
## [40] "test.R"
## [41] "test.R.out"
## [42] "tutorial"
## [43] "UCSC"
## [44] "UCSC_Intro_DataAnalysis-azhang1.R"
## [45] "USCounties_df_name.csv"
## [46] "USCounties_df_new.csv"
## [47] "USCounties_df_new.Rda"
## [48] "USCounties_name.csv"
## [49] "USCounties_new.csv"
## [50] "USCounties_new.Rda"
## [51] "USP.Rdata"
## [52] "USPresidents.csv"
## [53] "x.Rda"
## [54] "x.Rds"
getwd()
## [1] "c:/AGZ1/GD_AGZ1117/AGZ_Home/workspace_R"
HW1_US_Counties <- read.csv("data/HW1_US_Counties.csv", stringsAsFactors = FALSE)
#verify:
dim(HW1_US_Counties)
## [1] 3144 16
names(HW1_US_Counties)
## [1] "STNAME" "CTYNAME" "SUMLEV"
## [4] "REGION" "DIVISION" "STATE"
## [7] "COUNTY" "CENSUS2010POP" "POPESTIMATE2013"
## [10] "BIRTHS2013" "DEATHS2013" "NATURALINC2013"
## [13] "INTERNATIONALMIG2013" "USPS" "ALAND_SQMI"
## [16] "AWATER_SQMI"
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.