在R中外部运行命令提示符

时间:2017-07-10 17:56:19

标签: r shell cmd windows-console

我在R中编写脚本以在不同的加密货币挖掘算法之间切换。我使用R从使用以下代码获得的算法列表中确定最有利可图的算法:

library(rvest)

html_body <- read_html("https://whattomine.com/coins?utf8=%E2%9C%93&eth=true&factor%5Beth_hr%5D=70.0&factor%5Beth_p%5D=280.0&grof=true&factor%5Bgro_hr%5D=116.0&factor%5Bgro_p%5D=420.0&x11gf=true&factor%5Bx11g_hr%5D=39.0&factor%5Bx11g_p%5D=340.0&cn=true&factor%5Bcn_hr%5D=1660.0&factor%5Bcn_p%5D=280.0&eq=true&factor%5Beq_hr%5D=1270.0&factor%5Beq_p%5D=380.0&lre=true&factor%5Blrev2_hr%5D=128000.0&factor%5Blrev2_p%5D=380.0&ns=true&factor%5Bns_hr%5D=2800.0&factor%5Bns_p%5D=380.0&lbry=true&factor%5Blbry_hr%5D=920.0&factor%5Blbry_p%5D=380.0&bk2bf=true&factor%5Bbk2b_hr%5D=5500.0&factor%5Bbk2b_p%5D=380.0&bk14=true&factor%5Bbk14_hr%5D=8700.0&factor%5Bbk14_p%5D=420.0&pas=true&factor%5Bpas_hr%5D=3400.0&factor%5Bpas_p%5D=420.0&bkv=true&factor%5Bbkv_hr%5D=NaN&factor%5Bbkv_p%5D=NaN&factor%5Bcost%5D=0.16&sort=Profit&volume=0&revenue=current&factor%5Bexchanges%5D%5B%5D=&factor%5Bexchanges%5D%5B%5D=bittrex&factor%5Bexchanges%5D%5B%5D=bleutrade&factor%5Bexchanges%5D%5B%5D=btc_e&factor%5Bexchanges%5D%5B%5D=bter&factor%5Bexchanges%5D%5B%5D=c_cex&factor%5Bexchanges%5D%5B%5D=cryptopia&factor%5Bexchanges%5D%5B%5D=poloniex&factor%5Bexchanges%5D%5B%5D=yobit&dataset=Main&commit=Calculate&adapt_q_280x=0&adapt_q_380=0&adapt_q_fury=0&adapt_q_470=0&adapt_q_480=0&adapt_q_750Ti=0&adapt_q_10606=0&adapt_q_1070=0&adapt_q_1080=0&adapt_q_1080Ti=2&adapt_1080Ti=true")
data <- html_body %>%
  html_nodes(".table-vcenter div+ div") %>%
  html_text()
data <- gsub("\n +", "", data)

coins <- vector("character")
algorithms <- vector("character")

coins <- data[seq(1,length(data),2)]
algorithms <- data[seq(2,length(data),2)]

profitability <- html_body %>%
  html_nodes(".table-vcenter td:nth-child(8) strong") %>%
  html_text()
profitability <- gsub("\n +", "", profitability)

我打算每小时检查一次盈利能力,但我稍后会补充一下。我的问题是:运行每个矿工运行外部命令提示符的最佳方法是什么。例如,我尝试使用:

system("C:\\Users\\Alex\\Documents\\Miners\\ccminer-1.2-windows\\x86\\ccminer.exe")

有效,但R不再做任何其他事情。此外,我还没有找到一种方法来阻止代码运行,而无需手动触发逃生。正如您可能已经意识到的那样,我之前没有用R命令执行任何操作,所以任何帮助都会非常感激。

0 个答案:

没有答案
相关问题