summary(cars)
MET581-Lecture-02-Expore-R-homework
Exploring Data in R - Exercises
Overview
Quarto is a document format that allows you to create and render documents in multiple formats including HTML, PDF, and MS Word. For more details on using Quarto, see the Quarto website. When you render this document, it will generate output that includes both the content and the results of any embedded R code chunks. You can embed an R code chunk like this:
This will display a summary of the cars dataset like shown below:
speed dist
Min. : 4.0 Min. : 2.00
1st Qu.:12.0 1st Qu.: 26.00
Median :15.0 Median : 36.00
Mean :15.4 Mean : 42.98
3rd Qu.:19.0 3rd Qu.: 56.00
Max. :25.0 Max. :120.00
For your homework, you will answer the questions below using Quarto. Make sure to include both the code and results in your knitted PDF or html file.
Questions
- Use Quarto to write a paragraph explaining the tidyverse concept. Your paragraph should include:
- Example code
- Inline code
- Blockquotes
- Lists
- Bold or italic text
Create a tibble with columns labeled: name, age, height, gender. Your tibble should contain at least 13 rows of data.
- 2a: Use tibble code to select the data for row 4.
- 2b: Retrieve the height of a person based on their name.
- 2c: Calculate the ratio of men to women.
- 2d: Calculate the average age and the standard deviation.
Turn the dataset iris into a tibble.
Why might tibbles be preferable to traditional R data frames for data scientists?
List some of the most important options provided by the readr package.
Import the pheno_unclean.txt file using readr.
Identify any errors in the pheno_unclean.txt file using R code.