相关疑难解决方法(0)

从github读取CSV到R

我正在尝试从github读取一个CSV到R:

latent.growth.data <- read.csv("https://github.com/aronlindberg/latent_growth_classes/blob/master/LGC_data.csv")
Run Code Online (Sandbox Code Playgroud)

但是,这给了我:

Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") : unsupported URL scheme
Run Code Online (Sandbox Code Playgroud)

我试过?read.csv,?download.file,getURL(只有返回奇怪的HTML),以及在数据导入手册,但仍然无法知道如何使它发挥作用.

我究竟做错了什么?

r data-manipulation data-management

49
推荐指数
5
解决办法
4万
查看次数

当knitr必须下载zip文件时出错

由于与网络安全系统的冲突,我可以将数据文件从互联网下载到网络中可以在R中使用的区域,这是通过R本身下载它.当我在RStudio中运行脚本时它工作正常.当我尝试编写脚本时,我会得到消息Unsupported URL或者我会得到

Error in file(file, "rt") : cannot open the connection 
Calls: <Anonymous> ... withVisible -> eval -> eval -> read.csv -> 
    read.table -> file
Execution halted
Run Code Online (Sandbox Code Playgroud)

下面是在正常运行下但在编织过程中不起作用的代码.

url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2Factivity.zip"
download.file(url, "repdata-data-activity.zip")
unzip("repdata-data-activity.zip")
Run Code Online (Sandbox Code Playgroud)

如果文件不是一个zip我可以使用下载它RCurl,但是当我尝试的R坠毁,我也尝试过method = "curl", setInternet2(TRUE),并试图删除shttps,但他们都没有工作.

结果是我不能生产出问题的针织文件.我之前有一个非常类似的问题(CSV文件不是压缩的CSV文件,请参阅下面的链接)并尝试了建议但没有成功:从https网站获取数据时R产生"不支持的URL方案"错误

我使用的是Windows 7和RStudio

重复:这只是编织文档时的问题,而不是运行脚本时的问题.

zip curl r rstudio knitr

5
推荐指数
1
解决办法
1800
查看次数

标签 统计

r ×2

curl ×1

data-management ×1

data-manipulation ×1

knitr ×1

rstudio ×1

zip ×1