#' @title URL 2 Per 100 Possessions
#' @param url url for player
#' @description gets dataframe
#' @keywords NBA basketball-reference html
#' @importFrom magrittr %>%
#' @export
#' @examples
#' url2per100poss(url)
url2per100poss <- function(url) {
cont <- getContent(url)
if (length(cont) > 0) {
df <- cont[[4]]
df <- df %>%
dplyr::select(Season,Age,Tm,Lg,Pos,G,GS,MP,FG,FGA,`FG%`,`3P`,`3PA`,`3P%`,`2P`,
`2PA`,`2P%`,FT,FTA,`FT%`,ORB,DRB,TRB,AST,STL,BLK,TOV,PF,PTS,ORtg,DRtg) %>%
dplyr::rename(season = Season,
age = Age,
team = Tm,
league = Lg,
position = Pos,
games = G,
games_started = GS,
minutes_played = MP,
field_goals = FG,
field_goals_attempted = FGA,
field_goal_pct = `FG%`,
three_pt_fg = `3P`,
three_pts_attm = `3PA`,
three_pt_pct = `3P%`,
two_pt_fg = `2P`,
two_pt_attm = `2PA`,
two_pt_pct = `2P%`,
ft_made = FT,
ft_attm = FTA,
ft_pct = `FT%`,
off_reb = ORB,
def_reb = DRB,
tot_reb = TRB,
assists = AST,
steals = STL,
blocks = BLK,
turnovers = TOV,
fouls = PF,
points = PTS,
off_rating = ORtg,
def_rating = DRtg)
df <- df[1:which(df$season=='Career')-1,]
return (df)
} else {
return (NA)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.