---
title: "Week 3 Exercise - Describing & Visualizing"
author: "Bilbo Baggins"
date: "10-26-1985"
editor: visual
output: docx
editor_options: 
  chunk_output_type: console
  markdown: 
    wrap: 72
---

**Goal**: Work on importing data as well as being able to build a
pipeline from descriptives to reporting to visualizing.

### Load the Libraries & Data

```{r}

```

Your dataset is from a larger study that was examining the overall
impact of sleep on energy (and vice versa). Students in different areas
across the country completed various questionnaires. The current data is
a selection of overall sleep quality rating (0-100) and overall energy
level (0-100) across all cities. You will be asked to examine these
variables in a descriptive and visual way for your specific city.

|                  |         |            |
|------------------|---------|------------|
| Albuquerque      | Chicago | Pittsburgh |
| Atlanta          | Denver  | Rochester  |
| Boston           | Ithaca  | Sacramento |
| Champaign-Urbana | Madison | Seattle    |

Toronto should also be in there, but then the table wouldn't be even.

## Questions

With the data that you have imported, follow the following steps and
answer the questions along the way.

**Your City:**

### Number of Observations

❓After importing, how many total observations are there?

```{r}

```

✅Answer:

------------------------------------------------------------------------

The dataset has all cities involved in the study. You only want to keep
the data from your city. Create a new dataset that has only your city in
it.

❓How many total observations are there in your new dataset (for your
city)?

```{r}

```

✅Answer:

------------------------------------------------------------------------

### Calculating Descriptives

You should now have 2 datasets (1 for the entire sample, and 1 for your
city). Calculate and report the mean and standard deviation for **your
city**. *Hint: use the `describe()`* *function.*

| Your City    |
|--------------|
| Sleep Mean:  |
| Sleep SD:    |
| Energy Mean: |
| Energy SD:   |
| Correlation: |

Then, using the entire sample dataset, let's work on grouping our
variables based on the city to have a table with every city. Try using
the `group_by()` function in your process ([documentation for
group-by](https://dplyr.tidyverse.org/reference/group_by.html){target="_blank"})

❓How are the mean and standard deviations similar/different?

✅Answer:

------------------------------------------------------------------------

### Reporting Descriptive Statistics

Now that you have each of the pieces of information calculated for the
entire sample and your specific city, you can report it in text. It is
important to be able to report these basic descriptive statistics in a
meaningful way, so we will practice it as often as possible. Here is an
example:

> The sample as a whole was relatively young (*M* = 19.22, *SD* = 3.45).
>
> The average amount of drinks consumed was 3.37 (SD = 0.92).
>
> The relationship between sleep quality and cognitive performance was
> significantly different from zero (r = 0.39, *p* = .02)

❓Report the means and standard deviations in text for the two variables
in your city sample. Provide one sentence that reports the correlation.

✅Answer:

------------------------------------------------------------------------

### Your Recommendations

You now have seen all the descriptive data for the cities. You are
involved in a project that is going to provide an intervention to
individuals to improve their sleep to hopefully impact their mood.

❓Given the data you have observed, which city should your team target
first and why?

✅ Answer:

------------------------------------------------------------------------

### Visualizing

We have two variables and we would like to examine the relationship
between them. Use a scatterplot to highlight the relationship between
these two variables for your city.

Be sure that your plot has a clear main title and clear labels for each
axis.

```{r}

```

❓Describe the overall look of the data for your city.

✅Answer:

------------------------------------------------------------------------

As a class, we will review the different cities to see if we would be
able to come to some broad conclusion.

***End of the document. Remember to Render to Word***
