RCurl或XML Challenge:将Pastebin读入R中

Bra*_*sen 6 r

弯曲你的RCurl/XML肌肉.最短的代码获胜.解析为R:http://pastebin.com/CDzYXNbG

数据应该是:

structure(list(Treatment = structure(c(2L, 2L, 1L, 1L), .Label = c("C", 
"T"), class = "factor"), Gender = c("M", "F", "M", "F"), Response = c(56L, 
58L, 6L, 63L)), .Names = c("Treatment", "Gender", "Response"), row.names = c(NA, 
-4L), class = "data.frame")
Run Code Online (Sandbox Code Playgroud)

祝好运!

注意:此问题提供的虚拟数据:在ggplot2中的条形之间添加空格

cam*_*ken 5

与kohske相同的想法,但我认为稍微更短,更清晰

library(XML)
eval(parse(text=gsub('\r\n','\n',xpathApply(htmlTreeParse('http://pastebin.com/CDzYXNbG',useInternal=T),'//textarea',xmlValue))))
Run Code Online (Sandbox Code Playgroud)