library(rvest)url<-'http://stockq.cn/market/currency.php'web<-read_html(url)res<-web%>%html_table(fill=T)%>%.[8]%>%as.data.frameres<-res[c(3:5,12,23:25),c(1:3,5)]res[,2:3]<-lapply(res[,2:3],as.numeric)ChangeRate<-round(res$X3/res$X2,4)data<-data.frame(res[,1:3],ChangeRate,res[,4])names(data)<-c("Name","Price","ChangePrice","ChangeRate","Time")mydata<-data[order(-data$ChangeRate),]print(mydata) Name Price ChangePrice ChangeRate Time3 欧元/美元 1.1797 0.0130 0.0110 05:534 英镑/美元 1.3165 0.0049 0.0037 05:5423 澳币/美元 0.7631 0.0008 0.0010 05:5325 美元/加币 1.2732 -0.0001 -0.0001 05:5412 美元/日圆 113.4600 -0.1600 -0.0014 05:5324 纽币/美元 0.6875 -0.0028 -0.0041 05:535 美元/瑞士法郎 0.9897 -0.0066 -0.0067 05:53