Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

--- title: Homework Assignment 6 subtitle: Tidy Data author: Data Science Student output: html_notebook --- For this assignment you will be using the `gather()`, `spread()`,

--- title: "Homework Assignment 6" subtitle: "Tidy Data" author: Data Science Student output: html_notebook ---

For this assignment you will be using the `gather()`, `spread()`, and `separate()` functions (along with functions from `dplyr`) to _tidy up_ some data sets

## Problem 1 RStudio

1. Load the `tidyverse` package

```{r} library(tidverse) ```

2. Consider the following data frame

```{r} nba <- data.frame( player = c("James", "Durant", "Curry", "Harden", "Paul", "Irving"), team = c("CLEOH", "OAKCA", "OAKCA", "HOUTX", "HOUTX", "BOSMA"), day1points = c(25,23,30,41,26,20), day2points = c(24,25,33,45,26,23), row.names = NULL, stringsAsFactors = FALSE ) nba ```

3. Use `gather()` to create a data frame with columns `day` and `points`

```{r} # use gather() need help here

```

4. Use `separate()` to create two columns: one for the "city" and the other for the "state" from the column "team". Set the `sep` option to 3.

```{r} # use separate() need help here

```

5. Taking into account what you did in the previous exercises, use the right commands to _tidy up_ your dataset by creating 5 columns: "player", "team", "state", "day" and "points".

```{r} # use gather() and separate() need help here ```

- Plot your dataset by creating a _scatterplot_ with `day` in the x-axis and `points` in the y-axis. Use `aes(color = city, shape = player)` as aesthetics.

```{r} # use gather(), separate() and ggplot() ---need help

```

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions