Welcome to the Assignment Demo. In this assignment, we’ll be exploring functions in R and their applications. Please follow the instructions closely and ensure you understand each function’s utility.
For each function assigned to you, perform the following tasks:
# Example using Disney Movies
disney_movies <- data.frame(
Movie = c("The Lion King", "Frozen", "Aladdin", "Mulan", "Beauty and the Beast", "Tangled", "Pocahontas"),
Release_Year = c(1994, 2013, 1992, 1998, 1991, 2010, 1995),
IMDb_Rating = c(8.5, 7.4, 8.0, 7.6, 8.0, 7.7, 6.7),
Protagonist = c("Simba", "Elsa & Anna", "Aladdin", "Mulan", "Belle", "Rapunzel", "Pocahontas"),
Antagonist = c("Scar", "Duke of Weselton", "Jafar", "Shan Yu", "Gaston", "Mother Gothel", "Governor Ratcliffe"),
Main_Song = c("Circle of Life", "Let It Go", "A Whole New World", "Reflection", "Beauty and the Beast", "I See the Light", "Colors of the Wind")
)
# Display the created data frame
disney_movies
## Movie Release_Year IMDb_Rating Protagonist Antagonist
## 1 The Lion King 1994 8.5 Simba Scar
## 2 Frozen 2013 7.4 Elsa & Anna Duke of Weselton
## 3 Aladdin 1992 8.0 Aladdin Jafar
## 4 Mulan 1998 7.6 Mulan Shan Yu
## 5 Beauty and the Beast 1991 8.0 Belle Gaston
## 6 Tangled 2010 7.7 Rapunzel Mother Gothel
## 7 Pocahontas 1995 6.7 Pocahontas Governor Ratcliffe
## Main_Song
## 1 Circle of Life
## 2 Let It Go
## 3 A Whole New World
## 4 Reflection
## 5 Beauty and the Beast
## 6 I See the Light
## 7 Colors of the Wind# Example for the head() function
head(disney_movies)
## Movie Release_Year IMDb_Rating Protagonist Antagonist
## 1 The Lion King 1994 8.5 Simba Scar
## 2 Frozen 2013 7.4 Elsa & Anna Duke of Weselton
## 3 Aladdin 1992 8.0 Aladdin Jafar
## 4 Mulan 1998 7.6 Mulan Shan Yu
## 5 Beauty and the Beast 1991 8.0 Belle Gaston
## 6 Tangled 2010 7.7 Rapunzel Mother Gothel
## Main_Song
## 1 Circle of Life
## 2 Let It Go
## 3 A Whole New World
## 4 Reflection
## 5 Beauty and the Beast
## 6 I See the Light
head(disney_movies, 2)
## Movie Release_Year IMDb_Rating Protagonist Antagonist
## 1 The Lion King 1994 8.5 Simba Scar
## 2 Frozen 2013 7.4 Elsa & Anna Duke of Weselton
## Main_Song
## 1 Circle of Life
## 2 Let It Gohead(data_frame) or head(data_frame, n)
Output:
head() displays the first 6 rows of a data
frame.head(data_frame, n) returns the first n
rows of a data frame.Here are the functions assigned to each team member:
| Name | Assigned Function |
|---|---|
| Christina Nguyen | head() |
| Marina Zhao | tail() |
| Gardenia Chang | str() |
| Kelly Zhen | summary() |
| Jack Oberdorfer | length() |
| Emily Zhu | dim() |
| Wesley Martinez | class() |
| Francesca Casimiro | names() |
Enhance your R Markdown skills by incorporating various textual and code-related elements.
# Importing example
#your_dataframe <- read.csv("your_file.csv")Remember to follow all instructions carefully and reach out if you have any questions. Good luck!