Changes in the headers when I read files in R?

前端 未结 2 1234
忘掉有多难
忘掉有多难 2021-01-16 00:52

Whenever I read in a file using read.csv() with option header=T, the headers change in weird (but predictable) ways. A header name which ought to r

2条回答
  •  深忆病人
    2021-01-16 01:42

    Set check.names=FALSE in read.csv()

    read.csv(fullpath,sep="\t", header=FALSE, nrow=3, check.names=FALSE)
    

    From the help for ?read.csv:

    check.names

    logical. If TRUE then the names of the variables in the data frame are checked to ensure that they are syntactically valid variable names. If necessary they are adjusted (by make.names) so that they are, and also to ensure that there are no duplicates.

提交回复
热议问题