---
title: " Heatmap of NBA Players with a lower than or equal to 48% 3 point FG percentage & having more than 20pts"
output:
flexdashboard::flex_dashboard:
orientation: rows
social: menu
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(pheatmap)
library(dplyr)
```
```{r,include=FALSE}
url <- "http://datasets.flowingdata.com/ppg2008.csv"
nba_players <- read.csv(url, row.names = 1)
```
```{r,include=FALSE}
# Clustered Heatmap of NBA Players with lower than or equal to 48% 3point percentage
nba_players2 <- nba_players %>%
filter(X3PP <=.48,) %>%
filter(X3PP > .01) %>%
filter(PTS>20) %>%
select(-FTA,-FGA) %>%
rename(Number3PM = X3PM ) %>%
rename(Number3PA = X3PA ) %>%
rename(Number3PP = X3PP ) %>%
rename(Games_Played=G) %>%
mutate(FGP=FGP *100,
Number3PP=Number3PP *100,
FTP=FTP*100) %>%
mutate(Rebounds = ORB + DRB + TRB) %>%
select(-c(ORB,DRB,TRB,Number3PA)) %>%
relocate(Rebounds, .before='AST')
```
```{r}
```
### Stats by player
```{r}
pheatmap(nba_players2,scale='column')
```
```{r}
```
### Top Scorers
```{r}
knitr::kable(nba_players2[1:17,c('Games_Played','MIN','PTS')])
```
```{r}
```