Assignment Demo

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.

Stats Team

Objective

For each function assigned to you, perform the following tasks:

  1. Data Frame Creation:
    • Create a data frame related to a topic of your interest. It should have at least 7 rows.
    # 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
  2. Function Application:
    • Apply your assigned function to the data frame.
    # 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 Go
  3. Function Notes:
    • Describe the input and output of your function.
    Notes: Input: head(data_frame) or head(data_frame, n) Output:
    • By default, head() displays the first 6 rows of a data frame.
    • head(data_frame, n) returns the first n rows of a data frame.

Assigned Functions:

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()

Theory Team

Objective

Enhance your R Markdown skills by incorporating various textual and code-related elements.

  1. Text Elements:
    • Title
    • Subtitle (name, date, etc.)
    • Various text formatting: Bold, Italic, Strikethrough, > Blockquote, – Endash
    • Lists and Tables
  2. Code Chunks:
    • Include a string.
    • Define a variable.
    • Display a math equation of your choice.
  3. External Data:
    • In a separate CSV file, create a table (at least 3 columns and 5 rows).
    • Import the CSV into RStudio.
    # Importing example
    #your_dataframe <- read.csv("your_file.csv")
  4. Vector and Data Frame Creation:
    • Define 5 vectors that align with the info in your table.
    • Combine these vectors into a data frame. This should resemble your CSV table.

Submission Details

  • Files to Submit:
    1. RMD file: Your original code.
    2. HTML file: The output from your code.
  • Submission Link: Google Drive Folder

Remember to follow all instructions carefully and reach out if you have any questions. Good luck!