Problem 1
Problem 1, 6
Problem 4
Problem 2
Problem 1 (scan your drawing and link it with your .Rmd file)
Problem 2, 3
Problem 2
Problem 3
Problem 1
Problem 1
Problem 3
Problem 1
Problem 2
Problem 2
For the R built-in iris dataset, the following R code is given:
data(iris)
swidth.versicolor <- NULL
for (i in seq_len(nrow(iris)) ) {
if (iris$Species[i]=="versicolor") {
swidth.versicolor <- c(swidth.versicolor, iris$Sepal.Width[i])
}
}
Vectorize the above code.
Type and run the following R code.
data(iris)
head(iris$Sepal.Length[iris$Species])
Explain why you get those results.