Loading NBA Data set

This data set displays the statistical outputs of players drafted from 2008 - 2012 up until 2014.

nba <- read.csv("NBA Draft Class.csv")
names(nba) # See all column names
##  [1] "Year"                   "Pick"                  
##  [3] "Team"                   "Player"                
##  [5] "Position"               "College"               
##  [7] "Games"                  "Minutes"               
##  [9] "Total.Points"           "Total.Rebounds"        
## [11] "Total.Assists"          "Field.Goal.Percentage" 
## [13] "Three.Point.Percentage" "Free.Throw.Percentage" 
## [15] "Points.Per.Game"        "Rebounds.Per.Game"     
## [17] "Assists.Per.Game"       "Win.Share"             
## [19] "X"

Some Computations

Recall that head() displays the first 6 rows of our data.

head(nba)
##   Year Pick Team            Player Position
## 1 2008    1  CHI      Derrick Rose       PG
## 2 2008    2  MIA   Michael Beasley       SF
## 3 2008    3  MIN         O.J. Mayo       SG
## 4 2008    4  SEA Russell Westbrook       PG
## 5 2008    5  MEM        Kevin Love       PF
## 6 2008    6  NYK  Danilo Gallinari       SF
##                                 College Games Minutes Total.Points
## 1                 University of Memphis   289   10583         6017
## 2               Kansas State University   409   10170         5416
## 3     University of Southern California   435   14132         6447
## 4 University of California, Los Angeles   440   14932         8834
## 5 University of California, Los Angeles   364   11933         6989
## 6                            NoAttempts   285    8923         4138
##   Total.Rebounds Total.Assists Field.Goal.Percentage
## 1           1103          1954                 0.460
## 2           2007           539                 0.450
## 3           1414          1292                 0.433
## 4           2171          3045                 0.433
## 5           4453           898                 0.451
## 6           1327           546                 0.419
##   Three.Point.Percentage Free.Throw.Percentage Points.Per.Game
## 1                  0.312                 0.815            20.8
## 2                  0.348                 0.758            13.2
## 3                   0.38                 0.821            14.8
## 4                  0.305                 0.815            20.1
## 5                  0.362                 0.815            19.2
## 6                  0.369                 0.844            14.5
##   Rebounds.Per.Game Assists.Per.Game Win.Share     X
## 1               3.8              6.8      29.8 0.135
## 2               4.9              1.3      10.3 0.048
## 3               3.3              3.0      19.1 0.065
## 4               4.9              6.9      42.3 0.136
## 5              12.2              2.5      47.0 0.189
## 6               4.7              1.9      23.9 0.129

How many more games did Michael Beasley play in his first 6 seasons compared to Derrick Rose?

# Addition and Subtraction
409-289
## [1] 120
#How many combined?
409+289
## [1] 698

Multiplication/Division

How many games could Derrick Rose have played in his first 6 seasons? Note that there are 82 regular season games in the NBA.

6*82
## [1] 492
#How durable is Derrick Rose?
289/492
## [1] 0.5873984

To be specific, in his first 6 seasons, Derrick Rose only played in about 59% of possible regular season games.

More Calculator Operations

# Integer division
82 %/% 10
## [1] 8
# Modulo operator (Remainder)
82 %% 10
## [1] 2
# Powers
8^3
## [1] 512

Even More Functions

  • Exponentiation
    • exp(x)
  • Logarithms
    • log(x)
    • log(x, base = 10)
  • Trigonometric functions
    • sin(x)
    • asin(x)
    • cos(x)
    • tan(x)

Creating Variables

We can create variables using the assignment operator <-:

paul.george <- 13

We can then perform any of the functions on the variables:

# Logarithm
log(paul.george)
## [1] 2.564949
# Square root
sqrt(paul.george)
## [1] 3.605551
# Square
paul.george^2
## [1] 169

Rules for Variable Creation

  • Variable names can't start with a number
  • Variables in R are case-sensitive
  • Some common letters are used internally by R and should be avoided as variable names (c, q, t, C, D, F, T, I)
  • There are reserved words that R won't let you use for variable names e.g. (for, in, while, if, else, repeat, break, next)
  • R will let you use the name of a predefined function. Try not to overwrite those though!

Vectors

A variable does not need to be a single value. We can create a vector using the c() (combine) function:

What is the total number of points by 2008 top 5 draft picks through their first 6 seasons?

head(nba)
##   Year Pick Team            Player Position
## 1 2008    1  CHI      Derrick Rose       PG
## 2 2008    2  MIA   Michael Beasley       SF
## 3 2008    3  MIN         O.J. Mayo       SG
## 4 2008    4  SEA Russell Westbrook       PG
## 5 2008    5  MEM        Kevin Love       PF
## 6 2008    6  NYK  Danilo Gallinari       SF
##                                 College Games Minutes Total.Points
## 1                 University of Memphis   289   10583         6017
## 2               Kansas State University   409   10170         5416
## 3     University of Southern California   435   14132         6447
## 4 University of California, Los Angeles   440   14932         8834
## 5 University of California, Los Angeles   364   11933         6989
## 6                            NoAttempts   285    8923         4138
##   Total.Rebounds Total.Assists Field.Goal.Percentage
## 1           1103          1954                 0.460
## 2           2007           539                 0.450
## 3           1414          1292                 0.433
## 4           2171          3045                 0.433
## 5           4453           898                 0.451
## 6           1327           546                 0.419
##   Three.Point.Percentage Free.Throw.Percentage Points.Per.Game
## 1                  0.312                 0.815            20.8
## 2                  0.348                 0.758            13.2
## 3                   0.38                 0.821            14.8
## 4                  0.305                 0.815            20.1
## 5                  0.362                 0.815            19.2
## 6                  0.369                 0.844            14.5
##   Rebounds.Per.Game Assists.Per.Game Win.Share     X
## 1               3.8              6.8      29.8 0.135
## 2               4.9              1.3      10.3 0.048
## 3               3.3              3.0      19.1 0.065
## 4               4.9              6.9      42.3 0.136
## 5              12.2              2.5      47.0 0.189
## 6               4.7              1.9      23.9 0.129

y <- c(6017, 5416, 6447, 8834, 6989) # Creates vector of total points by top 5 picks

This displays, on average, the total number of points score per season.

Operations will then be done element-wise:

y / 6
## [1] 1002.8333  902.6667 1074.5000 1472.3333 1164.8333
#Average points per game through first 6 seasons

z <- y / 6

z / 82
## [1] 12.22967 11.00813 13.10366 17.95528 14.20528

This displays, on average, the number of points scored per game.

Getting Help

We will talk MUCH more about vectors in a later, but for now, let's talk about a couple ways to get help. The primary function to use is the help function. Just pass in the name of the function you need help with:

help(head) 

The ? function also works:

?head

Googling for help is a bit hard. You might need to search for R + CRAN + to get good results

R Reference Card

Your Turn

Using the R Reference Card (and the Help pages, if needed), do the following:

  1. Find out how many rows and columns the nba data set has. Figure out at least 2 ways to do this.
  2. Create a vector with the number of games played for the top 5 players.
  3. On average, how many games a season out of 6 total, did those 5 players participate?

Answers

1.

dim(nba) # Finds dimension of data frame
## [1] 169  19
str(nba) # Finds structure of data
## 'data.frame':    169 obs. of  19 variables:
##  $ Year                  : int  2008 2008 2008 2008 2008 2008 2008 2008 2008 2008 ...
##  $ Pick                  : int  1 2 3 4 5 6 7 9 10 11 ...
##  $ Team                  : Factor w/ 32 levels "ATL","BOS","BRK",..: 5 16 18 29 15 21 13 4 19 12 ...
##  $ Player                : Factor w/ 169 levels "Al-Farouq Aminu",..: 44 115 124 139 99 36 55 31 23 82 ...
##  $ Position              : Factor w/ 5 levels "C","PF","PG",..: 3 4 5 3 2 4 5 3 1 3 ...
##  $ College               : Factor w/ 69 levels "Arizona State University",..: 48 18 59 38 38 24 15 61 34 36 ...
##  $ Games                 : int  289 409 435 440 364 285 311 429 342 381 ...
##  $ Minutes               : int  10583 10170 14132 14932 11933 8923 10649 10710 11339 7611 ...
##  $ Total.Points          : int  6017 5416 6447 8834 6989 4138 5430 4354 6168 3221 ...
##  $ Total.Rebounds        : int  1103 2007 1414 2171 4453 1327 792 785 2494 729 ...
##  $ Total.Assists         : int  1954 539 1292 3045 898 546 1021 1731 494 1092 ...
##  $ Field.Goal.Percentage : num  0.46 0.45 0.433 0.433 0.451 0.419 0.442 0.404 0.511 0.411 ...
##  $ Three.Point.Percentage: Factor w/ 96 levels "0","0.038","0.053",..: 41 62 86 37 72 78 77 84 1 67 ...
##  $ Free.Throw.Percentage : Factor w/ 129 levels "0.25","0.402",..: 105 74 107 105 105 114 101 123 91 106 ...
##  $ Points.Per.Game       : num  20.8 13.2 14.8 20.1 19.2 14.5 17.5 10.1 18 8.5 ...
##  $ Rebounds.Per.Game     : num  3.8 4.9 3.3 4.9 12.2 4.7 2.5 1.8 7.3 1.9 ...
##  $ Assists.Per.Game      : num  6.8 1.3 3 6.9 2.5 1.9 3.3 4 1.4 2.9 ...
##  $ Win.Share             : num  29.8 10.3 19.1 42.3 47 23.9 17.4 23.7 31.6 13 ...
##  $ X                     : num  0.135 0.048 0.065 0.136 0.189 0.129 0.078 0.106 0.134 0.082 ...

2.

games <- c(289,409,435,440,364) # Vector of games

3.

games/6 # Divide games by 6 seasons
## [1] 48.16667 68.16667 72.50000 73.33333 60.66667

Some Useful Functions

There are a whole variety of useful functions to operate on vectors. A couple of the more common ones are length(), which returns the length (number of elements) of a vector, and sum(), which adds up all the elements of a vector.

length(games) # calculates the length of this vector
## [1] 5
sum(games) # Calculates the sum of the vector elements
## [1] 1937

Data Frames Introduction

  • nba is a data frame.
  • Data frames hold data sets
  • Not every column need be the same type - like an Excel spreadsheet
  • Each column in a data frame is a vector - so each column needs to have values that are all the same type.
  • We can access different columns using the $ operator.
draft <- nba$Year # Creates column named draft
school <- nba$College # Creates column named school
points <- nba$Total.Points # Creates column named points

More about Vectors

A vector is a list of values that are all the same type. We have seen that we can create them using the c() or the rep() function. We can also use the : operator if we wish to create consecutive values:

a <- 10:15
a
## [1] 10 11 12 13 14 15

We can extract the specific elements of the vector like so:

school[3] # Selects the 3rd school in the school column
## [1] University of Southern California
## 69 Levels: Arizona State University Baylor University ... Xavier University

The 69 levels represents the only 69 total schools who had a player drafted in this data set

Indexing Vectors

We saw that we can access individual elements of the vector. But indexing is a lot more powerful than that:

head(school)
## [1] University of Memphis                
## [2] Kansas State University              
## [3] University of Southern California    
## [4] University of California, Los Angeles
## [5] University of California, Los Angeles
## [6] NoAttempts                           
## 69 Levels: Arizona State University Baylor University ... Xavier University
school[c(1, 3, 5)] # Selects the 1st, 3rd, and 5th school
## [1] University of Memphis                
## [2] University of Southern California    
## [3] University of California, Los Angeles
## 69 Levels: Arizona State University Baylor University ... Xavier University

school[1:6] # Selects the 1st through 6th school
## [1] University of Memphis                
## [2] Kansas State University              
## [3] University of Southern California    
## [4] University of California, Los Angeles
## [5] University of California, Los Angeles
## [6] NoAttempts                           
## 69 Levels: Arizona State University Baylor University ... Xavier University

Logical Values

  • R has built in support for logical values
  • TRUE and FALSE are built in. T (for TRUE) and F (for FALSE) are supported but can be modified
  • Logicals can result from a comparison using
    • \(<\)
    • \(>\)
    • \(<=\)
    • \(>=\)
    • \(==\)
    • \(!=\)

Indexing with Logicals

We can index vectors using logical values as well:

x <- points[1:5] #Pulls the total points for first 5 players
x > 6000 # Which of the first 5 players points is greater than 6000
## [1]  TRUE FALSE  TRUE  TRUE  TRUE
x[x < 6000] # Which is less than 6000
## [1] 5416

We interpret this to mean that the second player, Michael Beasley, did not score 6000 points by the end of his 6th season.

Logical Examples

We gather the total minutes played for the players in the 2008 NBA draft.

minutes <- (nba$Minutes[nba$Year == 2008]) 
# creates variable, minutes, which is the minutes played by everyone in the 2008 draft class
str(minutes)
##  int [1:27] 10583 10170 14132 14932 11933 8923 10649 10710 11339 7611 ...

We see which minutes are below 8000 to find certain players which are labeled busts

bust <- minutes < 8000 # Finds players that play less than 8000 minutes
minutes[bust]
## [1] 7611 3841 6640 7351 1503 5129 5661 2111

This code locates players from 2008 who correspond to those minutes.

(nba$Player[bust][nba$Year == 2008])
##  [1] Jerryd Bayless    Anthony Randolph  Marreese Speights
##  [4] JaVale McGee      Alexis Ajinca     Kosta Koufos     
##  [7] Darrell Arthur    D.J. White        Terrence Williams
## [10] Earl Clark        James Johnson     Ty Lawson        
## [13] Eric Maynor       Omri Casspi       DeMarre Carroll  
## [16] Wayne Ellington   Gordon Hayward    Xavier Henry     
## [19] Patrick Patterson Luke Babbitt      Eric Bledsoe     
## [22] Elliot Williams   Quincy Pondexter  Jordan Crawford  
## [25] Bismack Biyombo   Jimmer Fredette   Alec Burks       
## 169 Levels: Al-Farouq Aminu Alec Burks Alex Len ... Xavier Henry

Your Turn

  1. Which college did DeMar DeRozan attend? Note: There are many ways to answer this. Some are faster than others.

  2. Find out how many players from the 2008 draft scored more than 6,000 points in their first 6 seasons.

Challenge: Calculate the sum of the total points for everyone who scored more than 6,000 points. (Hint: Make use of %in%)

Answers

1

nba$College[nba$Player == "DeMar DeRozan"]
## [1] University of Southern California
## 69 Levels: Arizona State University Baylor University ... Xavier University

2.

# Finds the players who minutes are above 6000
players.6000 <- (nba$Player[nba$Minutes > 6000])
players.6000
##  [1] Derrick Rose      Michael Beasley   O.J. Mayo        
##  [4] Russell Westbrook Kevin Love        Danilo Gallinari 
##  [7] Eric Gordon       D.J. Augustin     Brook Lopez      
## [10] Jerryd Bayless    Jason Thompson    Brandon Rush     
## [13] Robin Lopez       Marreese Speights Roy Hibbert      
## [16] JaVale McGee      J.J. Hickson      Ryan Anderson    
## [19] Courtney Lee      Serge Ibaka       Nicolas Batum    
## [22] George Hill       Blake Griffin     James Harden     
## [25] Tyreke Evans      Stephen Curry     DeMar DeRozan    
## [28] Brandon Jennings  Gerald Henderson  Jrue Holiday     
## [31] Ty Lawson         Jeff Teague       Darren Collison  
## [34] Omri Casspi       Taj Gibson        John Wall        
## [37] Evan Turner       Derrick Favors    Wesley Johnson   
## [40] DeMarcus Cousins  Greg Monroe       Al-Farouq Aminu  
## [43] Gordon Hayward    Paul George       Jordan Crawford  
## [46] Greivis Vasquez   Kyrie Irving      Tristan Thompson 
## [49] Brandon Knight    Kemba Walker      Klay Thompson    
## [52] Damian Lillard   
## 169 Levels: Al-Farouq Aminu Alec Burks Alex Len ... Xavier Henry

Challenge

# Finds the minutes for those players
each.points <- nba$Minutes[nba$Player %in% players.6000] 
sum.each.points <- sum(each.points) # Sums each element in vector
sum.each.points
## [1] 496271

Modifying Vectors

We can modify vectors using indexing as well. Here we create a new data frame that consists of the first 5 columns of the NBA data set.

x <- nba[1:5]
head(x)
##   Year Pick Team            Player Position
## 1 2008    1  CHI      Derrick Rose       PG
## 2 2008    2  MIA   Michael Beasley       SF
## 3 2008    3  MIN         O.J. Mayo       SG
## 4 2008    4  SEA Russell Westbrook       PG
## 5 2008    5  MEM        Kevin Love       PF
## 6 2008    6  NYK  Danilo Gallinari       SF

We replace all the years with 2014.

x[1] <- 2014
head(x)
##   Year Pick Team            Player Position
## 1 2014    1  CHI      Derrick Rose       PG
## 2 2014    2  MIA   Michael Beasley       SF
## 3 2014    3  MIN         O.J. Mayo       SG
## 4 2014    4  SEA Russell Westbrook       PG
## 5 2014    5  MEM        Kevin Love       PF
## 6 2014    6  NYK  Danilo Gallinari       SF

Vector Elements

Elements of a vector must all be the same type:

head(minutes)
## [1] 10583 10170 14132 14932 11933  8923
minutes[bust] <- ":-(" #Replacing minutes below 6000 with a frownie face.
head(minutes)
## [1] "10583" "10170" "14132" "14932" "11933" "8923"
minutes
##  [1] "10583" "10170" "14132" "14932" "11933" "8923"  "10649" "10710"
##  [9] "11339" ":-("   "12357" "8208"  ":-("   "8225"  ":-("   "11903"
## [17] ":-("   "10078" ":-("   "8909"  "11708" ":-("   "10483" "12448"
## [25] "12022" ":-("   ":-("

By changing a value to a string, all the other values got changed as well.

Data Types in R

  • Can use mode() or class() to find out information about variables
  • str() is useful to find information about the structure of your data
  • Many data types: numeric, integer, character, date, and factor most common
str(nba)
## 'data.frame':    169 obs. of  19 variables:
##  $ Year                  : int  2008 2008 2008 2008 2008 2008 2008 2008 2008 2008 ...
##  $ Pick                  : int  1 2 3 4 5 6 7 9 10 11 ...
##  $ Team                  : Factor w/ 32 levels "ATL","BOS","BRK",..: 5 16 18 29 15 21 13 4 19 12 ...
##  $ Player                : Factor w/ 169 levels "Al-Farouq Aminu",..: 44 115 124 139 99 36 55 31 23 82 ...
##  $ Position              : Factor w/ 5 levels "C","PF","PG",..: 3 4 5 3 2 4 5 3 1 3 ...
##  $ College               : Factor w/ 69 levels "Arizona State University",..: 48 18 59 38 38 24 15 61 34 36 ...
##  $ Games                 : int  289 409 435 440 364 285 311 429 342 381 ...
##  $ Minutes               : int  10583 10170 14132 14932 11933 8923 10649 10710 11339 7611 ...
##  $ Total.Points          : int  6017 5416 6447 8834 6989 4138 5430 4354 6168 3221 ...
##  $ Total.Rebounds        : int  1103 2007 1414 2171 4453 1327 792 785 2494 729 ...
##  $ Total.Assists         : int  1954 539 1292 3045 898 546 1021 1731 494 1092 ...
##  $ Field.Goal.Percentage : num  0.46 0.45 0.433 0.433 0.451 0.419 0.442 0.404 0.511 0.411 ...
##  $ Three.Point.Percentage: Factor w/ 96 levels "0","0.038","0.053",..: 41 62 86 37 72 78 77 84 1 67 ...
##  $ Free.Throw.Percentage : Factor w/ 129 levels "0.25","0.402",..: 105 74 107 105 105 114 101 123 91 106 ...
##  $ Points.Per.Game       : num  20.8 13.2 14.8 20.1 19.2 14.5 17.5 10.1 18 8.5 ...
##  $ Rebounds.Per.Game     : num  3.8 4.9 3.3 4.9 12.2 4.7 2.5 1.8 7.3 1.9 ...
##  $ Assists.Per.Game      : num  6.8 1.3 3 6.9 2.5 1.9 3.3 4 1.4 2.9 ...
##  $ Win.Share             : num  29.8 10.3 19.1 42.3 47 23.9 17.4 23.7 31.6 13 ...
##  $ X                     : num  0.135 0.048 0.065 0.136 0.189 0.129 0.078 0.106 0.134 0.082 ...

Converting Between Types

We can convert between different types using the as series of functions:

assists <- head(nba$Total.Assists) # Creates vector of first 6 players assist totals
assists
## [1] 1954  539 1292 3045  898  546
as.character(assists) # Converts to character
## [1] "1954" "539"  "1292" "3045" "898"  "546"
as.numeric("2") 
## [1] 2

Notice that in one instance there are quotation marks and in the other there is not. Hence one is a character and the other is numeric.

Statistical Functions

Using the basic functions we've learned it wouldn't be hard to compute some basic statistics.

(n <- length(points)) # Assigns n to be the number of elements in points
## [1] 169
(meanpoints <- sum(points)/n) # Calculates mean by usual formula
## [1] 2037.29
# Calculates standard deviation by usual formula
(standdev <- sqrt(sum((points - meanpoints)^2) / (n - 1))) 
## [1] 1862.153

This is fairly easy, that is, if you know the formulas!

Built-in Statistical Functions

We don't need to memorize formulas. R does the work for us!

mean(points) # Calculates mean
## [1] 2037.29
sd(points) # Calculates standard deviation
## [1] 1862.153
summary(points) # calculates number summary
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##       0     590    1432    2037    3137    8834
quantile(points, c(.025, .975)) # 2.5% and 97.5% quartiles
##   2.5%  97.5% 
##   43.0 6555.8

Element-wise Logical Operators

  • & (elementwise AND)
  • | (elementwise OR)
c(T, T, F, F) & c(T, F, T, F)
## [1]  TRUE FALSE FALSE FALSE
c(T, T, F, F) | c(T, F, T, F)
## [1]  TRUE  TRUE  TRUE FALSE

Which players averaged more than 20 points and 5 assists a game?

condition <- which(nba$Points.Per.Game > 20.0 & nba$Assists.Per.Game > 5.0)
nba[condition,]
##    Year Pick Team            Player Position
## 1  2008    1  CHI      Derrick Rose       PG
## 4  2008    4  SEA Russell Westbrook       PG
## 33 2009    7  GSW     Stephen Curry       PG
## 85 2011    1  CLE      Kyrie Irving       PG
##                                  College Games Minutes Total.Points
## 1                  University of Memphis   289   10583         6017
## 4  University of California, Los Angeles   440   14932         8834
## 33                      Davidson College   336   11946         6814
## 85                       Duke University   181    6102         3747
##    Total.Rebounds Total.Assists Field.Goal.Percentage
## 1            1103          1954                 0.460
## 4            2171          3045                 0.433
## 33           1378          2247                 0.467
## 85            666          1058                 0.447
##    Three.Point.Percentage Free.Throw.Percentage Points.Per.Game
## 1                   0.312                 0.815            20.8
## 4                   0.305                 0.815            20.1
## 33                   0.44                 0.896            20.3
## 85                  0.378                 0.862            20.7
##    Rebounds.Per.Game Assists.Per.Game Win.Share     X
## 1                3.8              6.8      29.8 0.135
## 4                4.9              6.9      42.3 0.136
## 33               4.1              6.7      38.1 0.153
## 85               3.7              5.8      16.0 0.126

Just Derrick Rose, Russell Westbrook, Stephen Curry, and Kyrie Irving!

Your Turn

  1. Is it more common to average 20 points and 5 assists a game or 20 points and 5 rebounds a game?
  2. Determine which player(s) from the 2009 draft class averaged more than 7.0 rebounds per game.
  3. Who scored more points in their first 6 seasons, Russell Westbrook or John Wall?

Answers

1.

condition1 <- which(nba$Points.Per.Game > 20.0 & nba$Assists.Per.Game > 5.0)
condition2 <- which(nba$Points.Per.Game > 20.0 & nba$Rebounds.Per.Game > 5.0)
length(condition1) #Finds how many players satisfy condition
## [1] 4
length(condition2) #Finds how many players satisfy condition
## [1] 1

2.

condition <- which(nba$Rebounds.Per.Game > 7.0 & nba$Year == 2009)
nba[condition,]
##    Year Pick Team        Player Position                College Games
## 28 2009    1  LAC Blake Griffin       PF University of Oklahoma   308
##    Minutes Total.Points Total.Rebounds Total.Assists Field.Goal.Percentage
## 28   10965         6583           3125          1130                 0.528
##    Three.Point.Percentage Free.Throw.Percentage Points.Per.Game
## 28                  0.232                 0.642            21.4
##    Rebounds.Per.Game Assists.Per.Game Win.Share     X
## 28              10.1              3.7      41.9 0.183

3.

westbrook.points <- nba$Total.Points[nba$Player == "Russell Westbrook"]
wall.points <- nba$Total.Points[nba$Player == "John Wall"]

westbrook.points < wall.points # Compares logical values
## [1] FALSE