Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.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
R中的download.file省略了内容_R_Download - Fatal编程技术网

R中的download.file省略了内容

R中的download.file省略了内容,r,download,R,Download,我用过R download.file('https://www.census.gov/retail/marts/www/marts_current.xls', method='auto', destfile='C:/Users/<my name>/Desktop/test.xls') download.file('https://www.census.gov/retail/marts/www/marts_current.xls“,method='auto', destfile

我用过R

download.file('https://www.census.gov/retail/marts/www/marts_current.xls', method='auto', 
  destfile='C:/Users/<my name>/Desktop/test.xls')
download.file('https://www.census.gov/retail/marts/www/marts_current.xls“,method='auto',
destfile='C:/Users//Desktop/test.xls')
希望在test.xls中看到marts_current.xls的内容,但源文件中的大部分内容被忽略了


有人能帮我理解为什么吗?我怎样才能得到整个文件

Excel
xls
文件是二进制文件,下载时应小心。
download.files
的默认设置是假定它们是文本文件。您可以使用
模式=
标志来控制这一点。使用

download.file('https://www.census.gov/retail/marts/www/marts_current.xls', method='auto', 
  destfile='C:/Users/<my name>/Desktop/test.xls', mode="wb")
download.file('https://www.census.gov/retail/marts/www/marts_current.xls“,method='auto',
destfile='C:/Users//Desktop/test.xls',mode=“wb”)

@MrFlick成功了。非常感谢。我从我的“xls客户端”(LibreOffice)收到一条警告消息,关于未执行的宏,但使用“wb”对下载文件的大小没有影响。