##Question 1
MyVectorInfo <- function(myVector){
mean <- mean(myVector)
min <- which.min(myVector)
max <- which.max(myVector)
info <- data.frame(mean,min,max)
return(info)}
##Question 5
y <- 3.4321
new_round <-function(p, digits =1)
{
round(y, digits)
}
c(new_round(y), new_round(y, digits = 3))
## [1] 3.400 3.432
##Question 6
thorw_dice <- function(){
round(runif(1,1,6),0)
}
##Question 7
library(ggvis)
mtcars %>% ggvis(~mpg, ~wt) %>%
layer_points() %>%
layer_smooths()
##Question 8
worthWithIndex <- function(col.index){
index <- which.min(mtcars$mpg)
rnames <- rownames(mtcars)
cars <- rnames[index]
return(cars)
}