Here's the whole thing. If it's any peace of mind, our competition ends today and I have already maxed out my submissions. However, i still need to know how to do this.
Thanks,
#Author: Sal Meza
#Created: 1/20/19
#Last edited: 1/29/19
#Competion1
ToTrain=read.csv(file = "train.csv", header = TRUE, sep = ",")
#> Warning in file(file, "rt"): cannot open file 'train.csv': No such file or
#> directory
#> Error in file(file, "rt"): cannot open the connection
#ToTrain$Fentanyl = as.factor(ToTrain$Fentanyl)
#train <- train[train$Home_Zip!="Homeless", ]
#train <- train[train$Home_Zip!="Unknown", ]
#train <- train[train$Education!="NA", ]
ToTest=read.csv(file = "test.csv", header = TRUE, sep = ",")
#> Warning in file(file, "rt"): cannot open file 'test.csv': No such file or
#> directory
#> Error in file(file, "rt"): cannot open the connection
#test <- test[test$Home_Zip!="Homeless", ]
#test <- test[test$Home_Zip!="Unknown", ]
#test <- test[test$Education!="NA", ]
install.packages("AUC")
#> Installing package into 'C:/Users/userOne/Documents/R/win-library/3.5'
#> (as 'lib' is unspecified)
#> package 'AUC' successfully unpacked and MD5 sums checked
#>
#> The downloaded binary packages are in
#> C:\Users\userOne\AppData\Local\Temp\RtmpeoX4U3\downloaded_packages
install.packages("caret")
#> Installing package into 'C:/Users/userOne/Documents/R/win-library/3.5'
#> (as 'lib' is unspecified)
#> package 'caret' successfully unpacked and MD5 sums checked
#> Warning: cannot remove prior installation of package 'caret'
#>
#> The downloaded binary packages are in
#> C:\Users\userOne\AppData\Local\Temp\RtmpeoX4U3\downloaded_packages
install.packages("e1071")
#> Installing package into 'C:/Users/userOne/Documents/R/win-library/3.5'
#> (as 'lib' is unspecified)
#> package 'e1071' successfully unpacked and MD5 sums checked
#> Warning: cannot remove prior installation of package 'e1071'
#>
#> The downloaded binary packages are in
#> C:\Users\userOne\AppData\Local\Temp\RtmpeoX4U3\downloaded_packages
library(AUC)
#> AUC 0.3.0
#> Type AUCNews() to see the change log and ?AUC to get an overview.
library(caret)
#> Error in library(caret): there is no package called 'caret'
library(e1071)
#> Error in library(e1071): there is no package called 'e1071'
library(reprex)
set.seed(569)
ctrl <- trainControl(method = "repeatedcv", number = 10, savePredictions = TRUE)
#> Error in trainControl(method = "repeatedcv", number = 10, savePredictions = TRUE): could not find function "trainControl"
model <- train(Fentanyl~
Age+Sex+Race+
Oxycodone+Hydrocodone+Buprenorphine+
Morphine+Codeine+Norbuprenorphine+
Naloxone,
ToTrain,
method = "glm", family = "poisson",
trControl = ctrl,
tuneLength = 10)#end train
#> Error in train(Fentanyl ~ Age + Sex + Race + Oxycodone + Hydrocodone + : could not find function "train"
#predicted <- predict(model, ToTrain["Fentanyl"], type = "prob")
#actual <- ToTrain["Fentanyl"]
Created on 2019-02-01 by the reprex package (v0.2.1)