在文件(文件,“ rt”)中出现错误:无法打开连接

时间:2019-07-25 17:35:29

标签: r

我是R的新手,所以我不确定大多数错误消息的含义。我正在尝试打开数据文件。但是,它向我发送了一个错误,我不确定哪里出了问题。

我尝试放入:

library(tidyverse)
airbnb_data <- read.csv("C:/Users/HoaLe's/Desktop/CURRENT QUARTER/225 Data and Society/Homework/hw-02/hw-02/Data/listings.csv")

错误消息:

Error in file(file, "rt") : cannot open the connection
3.
file(file, "rt")
2.
read.table(file = file, header = header, sep = sep, quote = quote, dec = dec, fill = fill, comment.char = comment.char, ...)
1.
read.csv("C:/Users/HoaLe's/Desktop/CURRENT QUARTER/\n 225 Data and Society/Homework/hw-02/hw-02/Data/listings.csv", stringsAsFactors = FALSE)

1 个答案:

答案 0 :(得分:0)

文件路径中似乎有换行符(最后一条错误消息中的\n)。尝试将所有内容放在一行上:

read.csv("C:/Users/HoaLe's/Desktop/CURRENT QUARTER/225 Data and Society/Homework/hw-02/hw-02/Data/listings.csv", stringsAsFactors = FALSE)