【问题标题】:showing error when iam trying to import xlsx file into R尝试将 xlsx 文件导入 R 时显示错误
【发布时间】:2020-07-09 22:07:54
【问题描述】:

d=read.csv(file.choose())
Warning messages:
1: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  line 1 appears to contain embedded nulls
2: In read.table(file = file, header = header, sep = sep, quote = quote,  :
  incomplete final line found by readTableHeader on 'C:\Users\xforce47\Desktop\airbnb .xlsx'
d=read.csv(file.choose())

警告信息: 1: 在 read.table(file = file, header = header, sep = sep, quote = quote, : 第 1 行似乎包含嵌入的空值 2: 在 read.table(file = file, header = header, sep = sep, quote = quote, : readTableHeader 在 'C:\Users\xforce47\Desktop\airbnb .xlsx' 上发现的最后一行不完整

【问题讨论】:

  • 为什么你使用read.csv读取excel文件?试试this

标签: r


【解决方案1】:

只需将文件另存为 .csv 并阅读即可。 正确设置工作目录 x

【讨论】:

    【解决方案2】:

    那是因为您尝试读取具有 csv 功能的 excel 文档。试试

    library(rio)
    
    d <- import(file.choose(), setclass = "tbl")
    

    相反。 setclass 参数是可选的,仅在使用 tidyverse 时才有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-13
      • 1970-01-01
      • 2013-10-09
      • 1970-01-01
      • 2013-05-02
      • 1970-01-01
      相关资源
      最近更新 更多