-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathW9.R
52 lines (28 loc) · 1.59 KB
/
W9.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Week 9: Advanced Data Manipulation with dplyr and Exploratory Data Analysis
# This week builds on prior data wrangling concepts,
# introducing advanced functions from dplyr to filter,
# group, summarize, and arrange data efficiently. Additionally,
# students will explore the basics of exploratory data analysis (EDA) techniques.
#
# Exercise 1: Filtering Data in iris
# Load the iris dataset.
# Filter rows where Petal.Length is greater than 4.
# Extract only columns Species, Sepal.Length, and Petal.Length for those rows.
# Exercise 2: Grouping and Summarizing Data
# Group the iris dataset by Species.
# Calculate the mean and standard deviation of Sepal.Width for each species.
# Save the results to a new data frame called iris_summary.
# Exercise 3: Arranging Data by Multiple Columns
# Arrange the rows of iris by Species (ascending) and Sepal.Length (descending).
# Show the first 10 rows of the sorted dataset.
# Exercise 4: Exploring Summary Statistics for EDA
# Compute the following summary statistics for Sepal.Length:
# Minimum, Maximum, Mean, Median, and Variance.
# Use the base R function summary() and compare the results.
# Exercise 5: Using dplyr's mutate() for Derived Columns
# Add a new column to iris called Petal.Ratio, calculated as Petal.Length / Petal.Width.
# Filter rows where Petal.Ratio is greater than 2.
# Show & Tell: Try Something New
# Explore a function from dplyr or another R package
# that wasn't covered in these exercises.
# Share your findings and demonstrate how you applied it to your dataset.