We see a fair number of submission errors where CSV headers of submissions don’t match the submission format. You’re probably a little annoyed if R
has just added some .
's on your behalf, but ultimately this check is there to help you out. Just imagine how much more frustrating it would be if your prediction columns were in the wrong order, and we happily gave you terrible scores while you pulled your hair out trying to find your bug.
If you’re pretty sure R has just added .
's to your prediction columns, here’s a quick fix to get the right headers in your submission. The magic is in the “check.names=FALSE” parameter, which stops R
from altering the column names:
# get the submission format from the file
submission_format <- read.csv("BloodDonationSubmissionFormat.csv", check.names=FALSE)
# update the predictions with the proper column names
colnames(my_predictions) <- colnames(submission_format)
# write the predictions to a file (may or may not need row.names=FALSE
# depending how you loaded the data)
write.csv(my_predictions, "my_predictions.csv", row.names=FALSE)
Hope that helps some people!
As always, you can use our command line submission validator tool to catch the errors before you’re faced with that pesky
(edit: formatting)