如何用R语言从网上读取多样格式数据
答案:1 悬赏:20 手机版
解决时间 2021-04-27 06:12
- 提问者网友:树红树绿
- 2021-04-27 01:15
如何用R语言从网上读取多样格式数据
最佳答案
- 五星知识达人网友:封刀令
- 2021-04-27 01:48
#####file CSV(from web)#####
install.packages("RCurl")
library(RCurl)
url=URLencode("http://`````````````````````````````````````````")
x=readLines(url,encoding="UTF-8")
col=unlist(strsplit(x[1],split=","))
data= array(0,c(length(x)-1,length(col)))
for(i in 2:length(x))
{
k = i-1
tmp=unlist(strsplit(x[i],split = ","))
for (jin 1:length(tmp))
{
data[k,j]=tmp[j]
}
}
colnames(data)=col
rownames(data)=data[,1]
install.packages("RCurl")
library(RCurl)
url=URLencode("http://`````````````````````````````````````````")
x=readLines(url,encoding="UTF-8")
col=unlist(strsplit(x[1],split=","))
data= array(0,c(length(x)-1,length(col)))
for(i in 2:length(x))
{
k = i-1
tmp=unlist(strsplit(x[i],split = ","))
for (jin 1:length(tmp))
{
data[k,j]=tmp[j]
}
}
colnames(data)=col
rownames(data)=data[,1]
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯