|
Post by Lasagna and tears of failure on Jul 9, 2021 10:29:19 GMT -8
hola
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:29:29 GMT -8
am I to 200 yet... fuck
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:29:46 GMT -8
anyone want the R script program?
|
|
|
Post by the original michael on Jul 9, 2021 10:29:58 GMT -8
Sim
|
|
|
Post by the original michael on Jul 9, 2021 10:30:08 GMT -8
Or trade
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:31:11 GMT -8
rm(list=ls()) options(stringsAsFactors = FALSE) options(digits=3) library('rvest') path <- "https://bballsim2020.com/" # ADD YEAR PLUS / FOR PAST SEASONS teams <- c("Celtics", "Heat", "Nets", "Knicks", "Magic", "76ers", "Wizards", "Hawks", "Hornets", "Bulls", "Cavaliers", "Pistons", "Pacers", "Bucks", "Raptors", "Mavericks", "Nuggets", "Rockets", "Timberwolves", "Spurs", "Jazz", "Grizzlies", "Warriors", "Clippers", "Lakers", "Suns", "Trail Blazers", "Kings", "SuperSonics") colMax <- function(data) sapply(data, max, na.rm = TRUE) get_player_stats <- function(player, team, start=1, end=200, per36=2){ stats <- c() for(i in 1:length(team)){ index <- which(team[i] == teams) url <- paste(path, "/rosters/roster", index, "sched.htm", sep="") webpage <- read_html(url) links <- html_attr(html_nodes(webpage, "a"), "href") links <- links[10:(length(links)-1)] for(j in 1:length(links)){ url <- paste(path, substr(links[j], 3, nchar(links[j])), sep="") day <- as.numeric(substr(url, gregexpr("boxes/", url)[[1]][1]+6, gregexpr("-", url)[[1]][1]-1)) if(day >= start & day <= end){ full_box <- html_table(read_html(url), header=TRUE, fill=TRUE) if(colnames(full_box[[2]])[1] == team[i]){ my_team_index <- 2 opp_team_index <- 3 } else{ my_team_index <- 3 opp_team_index <- 2 } box <- full_box[[my_team_index]] box_team <- box[1:(nrow(box)-2), 1:(ncol(box)-1)] box_team[,3:16] <- lapply(box_team[,3:16], as.numeric) colnames(box_team)[6:7] <- c("X3P", "X3PA") if(colnames(box_team)[1] == team[i]){ index <- which(box_team[,1] == player) if(length(index) > 0){ colnames(box_team)[1] <- "Team" stats <- rbind(stats, box_team[index,]) } } } } } if(is.null(stats)){ cat("No stats found.\n") } else if(nrow(stats) == 0){ cat("No stats found.\n") } else{ stats <- cbind.data.frame(GM=nrow(stats), stats[, 3:16]) cat("AVERAGES\n") averages <- colMeans(stats) print(round(averages, digits=1)) if(per36 == 1){ cat("PER 36\n") constant <- (36 / averages[2]) for(i in 2:length(averages)){ averages[i] <- constant * averages[i] } print(round(averages, digits=1)) } cat("PERCENTAGES\n") print(c(sum(stats$FG) / sum(stats$FGA), sum(stats$X3P) / sum(stats$X3PA), sum(stats$FT) / sum(stats$FTA))) cat("Totals\n") cat("points boards steals blocks\n") print(c(sum(stats$FG)*2 + sum(stats$X3P) + sum(stats$FT) , sum(stats$REB) , sum(stats$ST), sum(stats$BL))) } }
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:31:30 GMT -8
ofc that doesn't have the super secret functions I wrote
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:32:06 GMT -8
cause the RCEMR is a trade secret
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:32:16 GMT -8
more secret than the coke formula
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:32:28 GMT -8
coca cola that is
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:32:44 GMT -8
cause cocaine is not a secret formula
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:35:48 GMT -8
holy cow... still 58 posts to go
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:13 GMT -8
57
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:16 GMT -8
56
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:19 GMT -8
55
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:22 GMT -8
54
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:25 GMT -8
53
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:28 GMT -8
52
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:31 GMT -8
51
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:34 GMT -8
50
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:38 GMT -8
49
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:41 GMT -8
48
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:44 GMT -8
47
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:48 GMT -8
46
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:51 GMT -8
45
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:54 GMT -8
44
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:36:57 GMT -8
43
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:37:00 GMT -8
42
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:37:03 GMT -8
41
|
|
|
Post by Lasagna and tears of failure on Jul 9, 2021 10:37:06 GMT -8
40
|
|