我是R编程的初学者,我遇到了以下代码的问题:
library(xml2)
library(rvest)
library(stringr)
library(qdap)
atiire_details <- c()
for(i in 1:2){
html_pages1<-read_html(paste('E:\\Term 1\\Data collections\\assignmentData\\',i,'.html',sep = ''))
details <- html_nodes(html_pages1,'dl:nth-child(22)')
wp1<-html_text(details)
wp1<-gsub("\n","",wp1)
wp1<-str_trim(clean(wp1)) # Problem function here!
if(!(length(wp1)==0)){
if(!(wp1=='Take-out Yes')){
atiire_details[i]<-wp1
}}}
df<-data.frame()
df <- rbind(df, data.frame(atiire_details))
out <- capture.output(unique(df$atiire_details))
cat("My title", out, file="E:\\R\\op1.txt", sep="n", append=TRUE)
我一直收到以下错误:
清理错误(wp1):无法找到功能&#34;清理&#34;
有人可以帮我吗?在此先感谢:)
答案 0 :(得分:0)
顺便说一句,我使用了remove.packages(c(&#34; qdap&#34;,&#34; reshape2&#34;))并在RStudio中重新安装了qdap软件包。它工作了:)感谢您的帮助