############################################################# ### Code to read in the Bulls data for Problem 1 ############################################################# bulls<-read.table("https://people.stat.sc.edu/hitchcock/bulldata.txt",header=T) attach(bulls) # bulls contains all the variables in the data set (including Breed) bulls.numeric <- bulls[,-1] # bulls.numeric contains the numeric variables in the data set (everything except Breed) # Might be helpful: bull.labels <- row.names(bulls.numeric) ############################################################# ### Code to read in the NBA data for Problem 2 ############################################################# # Read this basic data file in, but we will remove some variables # and create some other variables for analysis. myNBAplayers2022 <- read.csv("https://people.stat.sc.edu/hitchcock/NBAplayers2022.csv",header=T) myNBAdata<-myNBAplayers2022[,-c(1,2,4,30)] # Creating some "per-game" or "per-minute-played" variables: myNBAdata$MinGame <- myNBAdata$MP/myNBAdata$G myNBAdata$ORBMin <- myNBAdata$ORB/myNBAdata$Min myNBAdata$DRBMin <- myNBAdata$DRB/myNBAdata$Min myNBAdata$ASTMin <- myNBAdata$AST/myNBAdata$Min myNBAdata$STLMin <- myNBAdata$STL/myNBAdata$Min myNBAdata$BLKMin <- myNBAdata$BLK/myNBAdata$Min myNBAdata$TOVMin <- myNBAdata$TOV/myNBAdata$Min myNBAdata$PFMin <- myNBAdata$PF/myNBAdata$Min myNBAdata$PTSMin <- myNBAdata$PTS/myNBAdata$Min # Removing some unneeded variables: myNBAdata_final <- myNBAdata[,-c(2,4,5,6,8,9,11,12,14,15,16,18:26)] attach(myNBAdata_final) # NOTE: myNBAdata_final is the numeric data set that should be analyzed. # The following code creates some character vectors that may be useful to you. # It's up to you whether you want to make use of them. PlayerName <- myNBAplayers2022[,1] PlayerName_short <- myNBAplayers2022[,30] key <- cbind(PlayerName, PlayerName_short) # you can print 'key' to see which "short" codes go with which players' names. Team <- myNBAplayers2022[,4] Position <- myNBAplayers2022[,2]