Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
导入XLS,readxl/gdata使用NA导入DF_R_Readxl - Fatal编程技术网

导入XLS,readxl/gdata使用NA导入DF

导入XLS,readxl/gdata使用NA导入DF,r,readxl,R,Readxl,我正在尝试将此.xls文件导入R: 我尝试直接从Windows机器上的url将其引入。我已经遇到了https与http的问题以及Windows的perl问题。为了解决这个问题,我尝试在ubuntu上运行,并先下载文件 我最近对readxl和gdata的两次尝试都产生了一个数据帧,尽管其中都没有任何数据。没有错误消息 NAREIT <- readxl::read_xls("~/Downloads/MonthlyHistoricalReturns.xls") NAREIT看起来有几行标题,所

我正在尝试将此.xls文件导入R:

我尝试直接从Windows机器上的url将其引入。我已经遇到了https与http的问题以及Windows的perl问题。为了解决这个问题,我尝试在ubuntu上运行,并先下载文件

我最近对readxl和gdata的两次尝试都产生了一个数据帧,尽管其中都没有任何数据。没有错误消息

NAREIT <- readxl::read_xls("~/Downloads/MonthlyHistoricalReturns.xls")

NAREIT看起来有几行标题,所以您需要弄清楚您想要什么样的标题,或者实际查阅一些有关堆栈溢出的页面,这些页面将向您展示如何处理两行标题

不管怎样,我可以像这样导入它,而且看起来还不错

library(readxl)
MonthlyHistoricalReturns <- read_excel("MonthlyHistoricalReturns.xls", sheet = "Index Data", skip = 7)
库(readxl)

每个月的历史回顾都很有趣。问题似乎与图纸名称有关。我几乎完全按照您的建议进行了尝试,使用skip=7来避免标题行,最后得到了1个变量的31个观察值的DF。我还尝试将工作表指定为1,这是唯一的工作表。用名字称呼工作表就可以了。非常感谢!
library(readxl)
MonthlyHistoricalReturns <- read_excel("MonthlyHistoricalReturns.xls", sheet = "Index Data", skip = 7)