Humphrey Zhao
2015-Jun-15 13:38 UTC
[R] Question about saving the context crawled by getNodeSet into a document
Dear?Sir/Madam: Thank?you?for?your?concern.?I?m?using?getNodeSet?in?XML?package?to?craw?data?from?web?pages,?and?I?need?to?save?it?as?a?document.?However,?I?tried?write.table,?write,?and?cat,?but?none?of?above?could?save?the?data.?The?error?messages?just?like?these:>?ac<-getNodeSet(article,?"//div[@class='entry-content']")?#attention?to?the?majuscule>?write.table(ac[[1]],?file="E:/????????/article.txt")Error?in?as.data.frame.default(x[[i]],?optional?=?TRUE)?:???c("cannot?coerce?class?\"c(\"XMLInternalElementNode\",?\"XMLInternalNode\",?\"XMLAbstractNode\"\"?to?a?data.frame",?"cannot?coerce?class?\")\"?to?a?data.frame")>?write(ac,?file="E:/????????/article.txt")Error?in?cat(list(...),?file,?sep,?fill,?labels,?append)?:???argument?1?(type?'list')?cannot?be?handled?by?'cat' I?have?tried?to?force?the?data?from?getNodeSet?into?data?frame,?but?it?does?not?work?either:>?tmp?<-?data.frame(ac)Error?in?as.data.frame.default(x[[i]],?optional?=?TRUE,?stringsAsFactors?=?stringsAsFactors)?:??????""XMLNodeSet""????????? I?really?confused?how?to?save?the?data?crawled by getNodeSet into a document.?I?wonder?if?you?could?give?me?some?advice?on?solving?this?problem?with?R.?And?I?would?be?most?grateful?if?you?could?reply?at?your?earliest?convenience.?Looking?forward?to?hearing?from?you.?Thank?you?very?much. ?????????????????????????????????????Sincerely?yours? ?????????????????????????????????????Humphrey?Zhao [[alternative HTML version deleted]]