![](/img/trans.png)
[英]R XLSX and XLConnect packages - Formatting the workbood object created by XLConnect using xlsx package?
[英]How to read .xlsx file using XLConnect in R
我想使用R從硬盤驅動器中讀取.xls或.xlsx文件。我安裝了XLConnect軟件包,並收到以下錯誤:
Data <- readWorksheet(loadWorkbook("C:/test1.xlsx"),sheet=1)
Error: FileNotFoundException (Java): File 'test1.xlsx' could not be found - you may specify to automatically create the file if not existing.
我想閱讀Excel文件的第一個標簽。 我還嘗試了gdata read.xls
函數,但失敗了。
在調用xlsx文件之前,嘗試定義工作目錄。 因此,在調用文件之前,請使用函數setwd。 例:
setwd("the location where the file is placed on your pc")
Data <- readWorksheet(loadWorkbook("C:/test1.xlsx"),sheet=1)
注意:確保在setwd函數中使用正斜杠而不是反斜杠。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.