XLConnect中的错误 [英] Error in XLConnect

查看:82
本文介绍了XLConnect中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Excel工作表导入r.我使用了以下代码:

I am trying to import an excel sheet into r. I used the following code:

x <- loadWorkbook("x.xlsx")
b <- readWorksheet(x, sheet="b")

第一行工作正常,但是运行第二行会出现以下错误:

The first line works fine, however, running the second gives the following error:

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘readWorksheet’ for signature ‘"jobjRef", "character"’

该工作表中没有缺失的值.

I have no missing values in that sheet.

出于复制目的,请从 https://github.com/ahmedfsalhin/1stpaper 下载trial.xlsx a>.

For the purpose of reproducing, download trial.xlsx from https://github.com/ahmedfsalhin/1stpaper.

系统信息:优胜美地操作系统.

system info: Yosemite operating system.

推荐答案

看来,根本原因"是您应该添加代码以指定函数及其所属的软件包.在这种情况下,键入XLConnect::loadWorkbook以选择所需的那个.在R中没有混乱"或重复选择的函数名称.选择取决于所有已加载软件包的加载顺序.使用search()查看为输入的命令检查软件包的顺序.

It appears the "root cause" is that you should add code to specify both the function and the package it belongs to. Type XLConnect::loadWorkbook to select the one you want in this case. There's no 'confusion,' or random selection of duplicated function names in R. The choice depends on the load order of all loaded packages. Use search() to see the order in which packages are checked for the command you've entered.

例如,目前我得到

search()
 [1] ".GlobalEnv"            "package:caTools"      
 [3] "package:XLConnect"     "package:XLConnectJars"
 [5] "package:stats"         "package:graphics"     
 [7] "package:datasets"      "package:vecsets"      
 [9] "package:cgwtools"      "package:grDevices"    
[11] "package:utils"         "package:methods"      
[13] "Autoloads"             "package:base"

您会注意到,首先选择了环境(.GlobalEnv)中的所有内容,例如,所有已加载的库都覆盖了base包.

You'll notice that anything in your environment (.GlobalEnv) is selected first, and that all loaded libraries override the base package, for example.

这篇关于XLConnect中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆