gpt4 book ai didi

r - RCurl或XML挑战: Read Pastebin into R

转载 作者:行者123 更新时间:2023-12-04 13:29:06 24 4
gpt4 key购买 nike

发挥您的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")

祝你好运!

注意:此问题所提供的伪数据: Adding space between bars in ggplot2

最佳答案

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

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

关于r - RCurl或XML挑战: Read Pastebin into R,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6086535/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com