# CSV Headers do not match

**URL:** <https://community.drivendata.org/t/csv-headers-do-not-match/45>\
**Category:** Warm Up: Predict Blood Donations\
**Created:** [January 15, 2015, 4:31am UTC](https://community.drivendata.org/t/csv-headers-do-not-match/45 "2015-01-15T04:31:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bull](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/bull/32/8_2.png) [@bull](https://community.drivendata.org/u/bull)\
**Post date:** [January 15, 2015, 4:31am UTC](https://community.drivendata.org/t/csv-headers-do-not-match/45/1 "2015-01-15T04:31:38Z")

</div>

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:

```auto
# 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](https://github.com/drivendataorg/drivendata-submission-validator) to catch the errors before you’re faced with that pesky ❗

(edit: formatting)

---

<div class="post-metadata">

**Author:** ![erum123](https://avatars.discourse-cdn.com/v4/letter/e/edb3f5/32.png) [@erum123](https://community.drivendata.org/u/erum123)\
**Post date:** [January 28, 2015, 5:37pm UTC](https://community.drivendata.org/t/csv-headers-do-not-match/45/2 "2015-01-28T17:37:31Z")

</div>

Thanks a lot. After trying a number of incorrect attempts, finally this post helped me submitting the result in the correct format .

---

<div class="post-metadata">

**Author:** ![Slevin11](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@Slevin11](https://community.drivendata.org/u/Slevin11)\
**Post date:** [July 3, 2016, 9:24pm UTC](https://community.drivendata.org/t/csv-headers-do-not-match/45/3 "2016-07-03T21:24:30Z")

</div>

Now this piece code of code will help me saving precious time. Thx a lot
