date()
## [1] "Tue Sep 20 21:03:30 2016"
Due Date: September 13, 2016
Total Points: 16
1 Assign to an object x the sum of 3 and 5. Find the square root of the sum (4).
x <- 3+5
sqrt(x)
## [1] 2.828427
2 Creat a vector (h) with the following elements and table the count frequencies: 2 4 0 3 1 0 0 1 2 0 (4).
h<-c(2,4,0,3,1,0,0,1,2,0)
3 Create a histogram from a set of random numbers.
y<-rnorm(1000)
df<- data.frame(y)
library("ggplot2")
y = rnorm(100)
df = data.frame(y)
head(df)
## y
## 1 -0.1955156
## 2 2.5874733
## 3 -1.0272424
## 4 0.2585525
## 5 1.6688076
## 6 1.1838957
library(ggplot2)
ggplot(df, aes(y)) +
geom_histogram(binwidth = .2)
Notes:
This is an R Markdown document. Markdown is a simple formatting syntax for creating web pages.
Make sure you have the knitr package installed on your computer.
The +C green icon 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.