View Single Post
Old 05-24-2019, 04:10 PM   #15
Insomniac
Major Leagues
 
Insomniac's Avatar
 
Join Date: Jul 2003
Posts: 386
Okay, finally got back to this to give it another try. I was able to work through the R code for the StandingsImport file. But I am getting errors on the SelectionCommittee code. Here are my results, with file paths removed:

> current <- 2018
>
> setwd("/Documents/Out of the Park Developments/NCAA QS Files/")
> library(dplyr)
>
> results <- read.csv(paste0("SelectionResults/selectionresults", current, ".csv"))
> #results <- results[,-1]
> #results$Tourney[is.na(results$Tourney)] <- 0
> results$tiebreaker[is.na(results$tiebreaker)] <- 0
> factors <- read.csv("Selection Factors.csv")
> factors <- factors[c(1:32),]
>
> # Upgrade / downgrade conferences by how well they played in non-conference
> obs <- tapply(results$ncwins, results$conf, FUN=sum) / (summary(results$conf)*18)
> sos <- c(.176,.122,.256,.127,.311,.16,.082,.263,.212,.189 ,.208,.284,.088,
+ .207,.126,.133,.233,.338,.198,.186,.132,.311,.155, .135,.222,.25,
+ .278,.244,.26,.301,.239,.244)
> SECpct <- obs * sos / (1 - obs - sos + 2 * obs * sos)
> baseline <- c(.481,.075,.412,.113,.163,.431,.313,.075,.150,.34 4,.334,.331,
+ .294,.094,.094,.075,.113,.088,.288,.313,.075,.113, .425,.094,
+ .5,.275,.294,.075,.325,.125,.125,.144)
> adjustment <- SECpct / baseline
> for (i in 1:length(adjustment)) {
+ if (adjustment[i] > 1.05) adjustment[i] <- 1.05
+ if (adjustment[i] < .95) adjustment[i] <- .95
+ }
> factors$x_0 <- factors$x_0 / (adjustment*.3 + .7*1)
>
> results.m <- merge(results, factors, by="conf")
Error in fix.by(by.y, y) : 'by' must specify a uniquely valid column
>

There are more errors that follow, but they are all keyed by this one and the resulting lack of a results.m value.

Any ideas on what I might be doing wrong?
__________________
Michael

Last edited by Insomniac; 05-31-2019 at 01:08 PM.
Insomniac is offline   Reply With Quote