在 R 中从 url 导入 .xls 的指定工作表
Import in R the specified worksheed of a .xls from url
我有兴趣直接在 R 中导入与以下 url 相关的 .xls 的一部分。 .xls 有两个不同的电子表格。我想导入从第二个电子表格的第 5 行开始的 table。尝试如下:
require(gdata)
url = "https://www.philadelphiafed.org/-/media/research-and-data/real-time-center/real-time-data/data-files/files/routput_first_second_third.xls?la=en.xls"
dataset = read.xls(url, sheet=2, header=T, skip=4)
我得到的错误是:
Error in file.exists(tfn) : invalid 'file' argument
我在 Windows 工作。 .xls 的来源是名称 "All available observations" 下的 here。非常欢迎您使用不同的包。
第一步是下载文件,然后就可以阅读了。
require(gdata)
url = "https://www.philadelphiafed.org/-/media/research-and-data/real-time-center/real-time-data/data-files/files/routput_first_second_third.xls?la=en.xls"
download.file(url, destfile="file.xls")
data<- read.xls("file.xls", header=TRUE, pattern="Rank", header=TRUE, sheet=2, skip=3)
我有兴趣直接在 R 中导入与以下 url 相关的 .xls 的一部分。 .xls 有两个不同的电子表格。我想导入从第二个电子表格的第 5 行开始的 table。尝试如下:
require(gdata)
url = "https://www.philadelphiafed.org/-/media/research-and-data/real-time-center/real-time-data/data-files/files/routput_first_second_third.xls?la=en.xls"
dataset = read.xls(url, sheet=2, header=T, skip=4)
我得到的错误是:
Error in file.exists(tfn) : invalid 'file' argument
我在 Windows 工作。 .xls 的来源是名称 "All available observations" 下的 here。非常欢迎您使用不同的包。
第一步是下载文件,然后就可以阅读了。
require(gdata)
url = "https://www.philadelphiafed.org/-/media/research-and-data/real-time-center/real-time-data/data-files/files/routput_first_second_third.xls?la=en.xls"
download.file(url, destfile="file.xls")
data<- read.xls("file.xls", header=TRUE, pattern="Rank", header=TRUE, sheet=2, skip=3)