1
您好我不能得到這個功能的工作....xpathSApply()返回行(),h3lp請
在網頁:
http://www.meetup.com/stats-prog-dc/members/?sort=chapter_member.atime&desc=1&offset=3
有與memName類的鏈接,例如:
<a href="http://www.meetup.com/stats-prog-dc/members/94995702/" class="memName">Asuri</a>
在R,I輸入下面的命令:
>web <- getURL("http://www.meetup.com/stats-prog-dc/members/?sort=chapter_member.atime&desc=1&offset=3", ssl.verifypeer = FALSE)
>webhtml <- htmlTreeParse(web,error=function(...){},useInternalNodes=TRUE,encoding="UTF-8",trim=TRUE)
>vNames <- xpathSApply(webhtml,'//*[@class="memName "]', xmlValue)
>vNames
問題是vNames返回「list()」而不是包含「Asuri」和所有其他名稱的列表。請爲什麼它不工作這是殺了我,在R的幫助是如此不清楚。
爲什麼xpathSApply返回一個錯誤,如果我不把參數放在htmlTreeParse(web)中? xpathSApply中的參數xmlValue是什麼,它甚至沒有提到它的幫助頁面!
尼斯感謝的,現在我明白了更多,對不起,我是新R和腳本 – Wicelo