[英]Import specific sheets and specific rows and specific columns from Excel file from readxl package in R
I have a excel file(both xls and xlsx format) with multiple sheets. 我有一个带有多个工作表的Excel文件(xls和xlsx格式)。 I have installed readxl package in R. I tried with the below code to import specific sheets, specific rows to columns but getting the error 我已经在R中安装了readxl程序包。我尝试使用以下代码将特定的工作表,特定的行导入列,但出现错误
install.packages("readxl")
library("readxl")
sam1 <- read_excel("File1","Sheet1",rowIndex = 6:8,colIndex = 1:13)
Error in read_excel("File1", "Sheet1", rowIndex = 6:8, : unused arguments (rowIndex = 6:8, colIndex = 1:13) read_excel(“ File1”,“ Sheet1”,rowIndex = 6:8,中的错误:未使用的参数(rowIndex = 6:8,colIndex = 1:13)
Can we solve this? 我们可以解决这个问题吗?
You are probably mistaking the readxl
package with the xlsx
package. 您可能会readxl
软件包与xlsx
软件包一起使用。 Both of them have a read_xlsx()
function with different arguments tho. 它们都具有带有不同自变量tho的read_xlsx()
函数。
The result you want can be achieve with the xlsx
package. 您可以使用xlsx
软件包获得所需的结果。 You simply have to install the package : 您只需要安装软件包:
install.packages("xlsx")
library("xlsx")
sam1 <- read_excel("File1", "Sheet1", rowIndex = 6:8, colIndex = 1:13)
or 要么
sam1 <- xlsx::read_excel("File1", "Sheet1", rowIndex = 6:8, colIndex = 1:13)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.