date()
## [1] "Thu Aug 30 13:45:58 2012"
Due Date: September 13, 2012
(1) Assign to an object x the sum of 3 and 5. Find the square root of the sum (2).
x = 3 + 5
sqrt(x)
## [1] 2.828
(2) Table the following numbers in a vector h: 2 4 0 3 1 0 0 1 2 0.
h = c(2, 4, 0, 3, 1, 0, 0, 1, 2, 0)
table(h)
## h
## 0 1 2 3 4
## 4 2 2 1 1
(3) Create a bar plot showing the numbers in h by frequency.
barplot(table(h), ylab = "Frequency", xlab = "Number")
Notes:
Change the Preferences > Sweave > Weave Rnw files using knitr.
Click the MD toolbar button for help with Markdown syntax.
Code > Insert Chunk will generate the chunk delimiters.
When you click the Knit HTML button a web page will be generated that includes content and the output of your R code chunks within the document.