OKAY , so I am being asked to CREATE a project using tidyverse I personally want to say, its sad that we have no fall break.students need a break.It’s school week after week. I want a Jewish Holiday off. and by off I mean the assignment is not due that following Sunday. I did not even get class off because my lectures are mid week but I digress. It is probably a managemnt thing. Need some soft skills
Let’s get into the assignment
The purpose of this assignment is the following: Your task here is to Create an Example. Using one or more TidyVerse packages, and any dataset from fivethirtyeight.com or Kaggle, create a programming sample “vignette” that demonstrates how to use one or more of the capabilities of the selected TidyVerse package with your selected dataset.
We decided on tattoo data because I like them but my mother and Co believe them to be things for the heathens so the article touch me and my stressed out heart.
DOWNLOAD PACKAGES
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.1 ✔ purrr 1.0.1
## ✔ tibble 3.2.1 ✔ dplyr 1.1.2
## ✔ tidyr 1.3.0 ✔ stringr 1.5.0
## ✔ readr 2.1.4 ✔ forcats 1.0.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(dplyr)
library(readr)
datadf = read_csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/nba-tattoos/nba-tattoos-data.csv")
## Rows: 636 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Player Name, Tattoos yes/no
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(datadf)
## # A tibble: 6 × 2
## `Player Name` `Tattoos yes/no`
## <chr> <chr>
## 1 A.J. Price no
## 2 Aaron Gray no
## 3 Al Horford no
## 4 Al Jefferson no
## 5 Al Thornton no
## 6 Alan Anderson no
summary(datadf)
## Player Name Tattoos yes/no
## Length:636 Length:636
## Class :character Class :character
## Mode :character Mode :character
#Here I used pipe and the group_by_all function to count all the “no” and “yes” and create a new dataframe
newdf = datadf %>%
group_by(`Tattoos yes/no`) %>%
count()
newdf
## # A tibble: 2 × 2
## # Groups: Tattoos yes/no [2]
## `Tattoos yes/no` n
## <chr> <int>
## 1 no 288
## 2 yes 348
#Here I have a bar graph demonstrating the frequency of no tattoos vs tattoos of the basketball players in my data
newdf %>%
ggplot(aes(x=`Tattoos yes/no`,y=n, fill=`Tattoos yes/no`))+
geom_bar(stat = "identity")+
ggtitle("The Count of Basketball Players with Tattos vs those without")
This bar graph demonstrates that there is a very small difference in count between basketball players that have tattoos versus those that do not have tattoo. I made this graph using ggplot to create a bar graph and tidyverse to group and count all the “no” together and counted all the “yes” together.
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.