shja
shja

Reputation: 3

After importing CSV into R, the headers are not what I want

This is my CSV file (see below) with the headers "data entry", "assessor", "school name" etc, but when I import the csv file the headers become "V1", "V2", "V3" etc as shown below. what should I do so that I remain with the headers like in the csv format since its interfering with the analysis because now the headers are now seen as part of the data entered and I cant overide them manually there too many and I have too many files. Thanks.

My CSV file:

enter image description here

Header:

enter image description here

Upvotes: 0

Views: 1248

Answers (1)

siphr
siphr

Reputation: 421

For R, the read module provides methods to read in tables and csvs. You can check the relevant documentation by typing:

help(read.csv)

Here is the snippet from help that tells you the signature of the method:

read.csv(file, header = TRUE, sep = ",", quote = "\"", dec = ".", fill = TRUE, comment.char = "", ...)

Note the second parameter list, header, has a default argument passed to it which is TRUE. This means that if you do not set it to FALSE, it will always read the header.

Because you have not shared the code, I can only guess that maybe this is your problem.

Upvotes: 1

Related Questions