library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.3.3
## Warning: package 'tidyr' was built under R version 4.3.3
## Warning: package 'readr' was built under R version 4.3.3
## Warning: package 'purrr' was built under R version 4.3.3
## Warning: package 'lubridate' was built under R version 4.3.3

If RStudio asks you to install packages with a yellow warning sign at the top of this document accept to install the packages.

After the installations, I recommend you to first Knit this document then read and answer the questions after knitting. If you cannot knit this document prior to start answering the questions, email instructor right away.

Remember that in order for me to grade your homework, you have to write everything in this R Markdown document, as I will not be able to see your Console or Environment.

Make sure your document knits after answering all questions and to use tidyverse style.

Question 1 (2 pts)

Write your name as the author on this file and add a date. Knit this document.

Question 2 (2 pts)

Find the quantity of the following expression in one step with one line of code. \[\frac{6!-120+(65+5)^2}{25}\]

((factorial(6)-120+(65+5)^2))/(25)
## [1] 220

Question 3 (3 pts)

Create an object, called it “my_height”, and assign your corresponding height in inches. Display its value by running its name.

my_height = 66;
print(my_height)
## [1] 66

Question 4 (2 pts)

Determine your height in centimeters using “my_height” and the conversion of 1 in = 2.54 cm.

my_height_centi = my_height * 2.54
print(my_height_centi)
## [1] 167.64

Question 5 (3 pts)

Create a vector with the following values and call it “height”: 68, 56, 61, 71, 65. Display the values.

height <- c(68, 56, 61, 71, 65)
height
## [1] 68 56 61 71 65

Question 6 (3 pts)

What is the average height in the previous list? Show work in the R code chunk by using the formula for the average or a function. Are you taller or shorter than the average height calculated?

mean_height <- mean(height)
mean_height
## [1] 64.2

Question 7 (4 pts)

Recreate the following contingency table into a data frame.

Name Height
Mike 56
Lupita 61
Sameer 65
Valery 68
Tam 71
names <- c("Mike", "Lupita", "Sameer", "Valery", "Tam")
heights <- c(56, 61, 65, 68, 71)

my_df <- data.frame(names, heights)
my_df
##    names heights
## 1   Mike      56
## 2 Lupita      61
## 3 Sameer      65
## 4 Valery      68
## 5    Tam      71

Question 8 (2 pts)

Install the package cowsayin the Console. Load the package using the function library() in the R code chunk.

install.packages("cowsay", repos = "https://cloud.r-project.org")
## Installing package into 'C:/Users/drnan/AppData/Local/R/win-library/4.3'
## (as 'lib' is unspecified)
## 
##   There is a binary version available but the source version is later:
##        binary source needs_compilation
## cowsay  1.2.0  1.2.2             FALSE
## installing the source package 'cowsay'
library(cowsay)
#installed.packages()

Question 9 (2 pts)

Run the function say(). Write in words what you see in the output?

say("Hello world!", by = "cow")
## 
##  ______________ 
## < Hello world! >
##  -------------- 
##       \
##        \
## 
##         ^__^ 
##         (oo)\ ________ 
##         (__)\         )\ /\ 
##              ||------w|
##              ||      ||
print("I see a picture of a cow.")
## [1] "I see a picture of a cow."

Question 10 (2 pts)

Find the documentation of the function say() and customize it so that the output is a different object and different saying.

say("Project Hail Mary", by = "owl")
## 
##  ___________________ 
## < Project Hail Mary >
##  ------------------- 
##     \
##      \
## 
##        /\___/\
##        {o}{o}|
##        \ v  /|
##        |    \ \
##         \___/_/       [ab]
##           | |