请问错误在哪里?怎么从R语言导出数据?

2025-05-09 01:00:28
推荐回答(1个)
回答1:

#url_2都没有定义。
#想保存

lapply(movies,function(x) xpathSApply(x,"//span[@class='title']",xmlValue))

#的结果,得先用值存结果

mov <- lapply(movies,function(x) xpathSApply(x,"//span[@class='title']",xmlValue))

#mov是list,得转换一下,结果付给url_2

url_2 <- unlist(mov)

#然后保存
write.table(url_2,'E:/movies.csv',sep=',',col.names=NA)