year_corr: An NBA Correlation Matrix Function

Description Usage Arguments Note Author(s) Examples

View source: R/year_corr.R

Description

This function that outputs a correlation matrix among all numeric variables in the Seasons_Stats_NBA dataset.

Usage

1
year_corr(year)

Arguments

year

Note

Need to load the Seasons_Stats_NBA dataset from https://www.kaggle.com/drgilermo/nba-playe-stats#Seasons_Stats.csv for this funtction to work.

Author(s)

Allison De Jong

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (year)
{
    x <- select_if(dNBA, is_numeric) %>% filter(Year == year) %>%
        select(-Year) %>% drop_na()
    y <- cor(x)
    result <- round(y, digits = 2)
    return(result)
  }

allison602/NBA documentation built on March 6, 2020, 12:03 a.m.