reading in a text file with a SUB (1a) (Control-Z) character in R on Windows

前端 未结 2 802
予麋鹿
予麋鹿 2020-12-14 23:12

Following on from my query last week reading badly formed csv in R - mismatched quotes, these same CSV files also have embedded control characters such as the ASCII Substitu

2条回答
  •  温柔的废话
    2020-12-14 23:48

    I also ran into this problem when I used read.csv with a csv file that contained the SUB or CTRL-Z in the middle of the file.

    Solved it with the readr package (if your file is comma separated)

    library(readr)
    read_csv("h3.txt")
    

    If you have a ; as a separator, then use:

    library(readr)
    read_csv2("h3.txt")
    

提交回复
热议问题