【发布时间】:2020-03-25 19:51:01
【问题描述】:
我正在尝试将 XLSX 文件导入 R 以开始我的课程项目。它给我带来了问题,因为它返回了一个包含 0 个变量的结果。我试图多次修改文件的路径,但没有不同的结果。有人知道我做错了什么吗?
我的意见:
customer_data <- fread("~C:\\matly\\Desktop\\Grad School\\Class 4\\Customer.xlsx", stringsAsFactors=FALSE)
输出:
The filename, directory name, or volume label syntax is incorrect.
Warning messages:
1: In (if (.Platform$OS.type == "unix") system else shell)(paste0("(", :
'(~C:\matly\Desktop\Grad School\Class 4\Customer.xlsx) > C:\Users\matly\AppData\Local\Temp\RtmpGs4FDg\file434f8231' execution failed with error code 1
2: In fread("~C:\\matly\\Desktop\\Grad School\\Class 4\\Customer.xlsx", :
File 'C:\Users\matly\AppData\Local\Temp\RtmpGs4FDg\file434f8231' has size 0. Returning a NULL data.table.
【问题讨论】:
-
fread不读取 XLSX 文件,为此您需要实例包readxl,函数read_excel。 -
另外,不确定文件名开头的波浪号 (
~) 在做什么...