假设我有一个像下面这样凌乱的文本文件
Today is a good
day, but I feel very tired. It seems like it is
going to rain pretty soon.
我想将 txt 文件作为字符向量读入 R,就像它在原始文本文件中的显示方式一样。换句话说,我想让字符向量的第一个元素是第一行,字符向量的第二个元素是第二行,等等,如下所示
char_vector[1] = "Today is a good"
char_vector[2] = "day, but I feel very tired. It seems like it is"
char_vector[3] = "going to rain pretty soon."
我已经尝试过 read.table 和 read.csv,但总是有一些行作为一条线连接在一起。有没有办法来解决这个问题?