简体   繁体   中英

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:

在此处输入图片说明

Header:

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM