library(readxl)
Lakers_Team_Stats <- read_excel("Desktop/Lakers Team Stats.xlsx")
#> Error: path
does not exist: 'Desktop/Lakers Team Stats.xlsx'
library(readxl)
Lakers_Record <- read_excel("Desktop/Lakers Record.xlsx")
#> Error: path
does not exist: 'Desktop/Lakers Record.xlsx'
library(reprex)
require(dplyr)
#> Loading required package: dplyr
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
require(ggplot2)
#> Loading required package: ggplot2
require(tidyverse)
#> Loading required package: tidyverse
#WinPercentage of the Team after season
mydata <- Lakers_Record %>% select(Pts,Opp,W,L)%>%
- mutate(wpct=Pts^13.91/(Pts^13.91+Opp^13.91),expwin=round(wpct*(W+L)),diff=W-expwin)
#> Error in eval(lhs, parent, parent): object 'Lakers_Record' not found
head(mydata)
#> Error in head(mydata): object 'mydata' not found
#Usage Percentage
Usgpct <- Lakers_Overall_Stats %>% select(FGA,FTA,TOV,MP,TmFga,TmFta,TmTov,TmMin)%>%
filter(rank(desc(Usgpct))==1)%>%
mutate(100*(Fga+0.44*Fta+Tov))TmMin/(TmFga+0.44TmFta+TmTov)*5(MP)
#> Error in eval(lhs, parent, parent): object 'Lakers_Overall_Stats' not found
head(Usgpct)
#> Error in head(Usgpct): object 'Usgpct' not found
#Specifiying
TmMin <- Lakers_Overall_Stats[23,6]
#> Error in eval(expr, envir, enclos): object 'Lakers_Overall_Stats' not found
TmFga <- Lakers_Overall_Stats[23,8]
#> Error in eval(expr, envir, enclos): object 'Lakers_Overall_Stats' not found
TmFta <- Lakers_Overall_Stats[23,18]
#> Error in eval(expr, envir, enclos): object 'Lakers_Overall_Stats' not found
TmTov <- Lakers_Overall_Stats[23,26]
#> Error in eval(expr, envir, enclos): object 'Lakers_Overall_Stats' not found
#Plot of the team wins
ggplot(mydata,aes(expwin,W)) + geom_point() + stat_smooth(method = "lm") +
scale_colour_manual(values = colors)
#> Error in ggplot(mydata, aes(expwin, W)): object 'mydata' not found
colors <- c("W" = "Green", "expwin" = "blue")
mod <- lm(W~expwin,data = mydata)
#> Error in is.data.frame(data): object 'mydata' not found
mod
#> Error in eval(expr, envir, enclos): object 'mod' not found
summary(mod)
#> Error in summary(mod): object 'mod' not found