r - UseMethod(“read_xml”)中的错误:没有适用于“read_xml”的方法应用于“list”类的对象
问题描述
我有一些文本文件的向量。这是我如何处理的
text[1] <- read_html("link1")
text[2] <- read_html("link2")
text[3] <- read_html("link3")
.
. until text [100]
我想创建一个具有以下内容的语料库:
x <- list(text[i])
z <- lapply(x, read_html)
我有
Error in UseMethod("read_xml") : no applicable method for 'read_xml' applied to an object of class "list"
在该错误之前,它是逻辑数据,我已将 text[i] 转换为以下内容
text[i] <- as.character (text[i])
另外,我得到了
number of items to replace is not a multiple of replacement lengthnumber of items to replace is not a multiple of replacement
我不知道发生了什么。谢谢。
解决方案
我试过了:
x <- rep("https://www.google.com/", 3)
z <- lapply(x, read_html)
它有效吗?
推荐阅读
- python - odoo 导入 .xlsx sale_order, purchase_order
- php - 更改全额付款和押金付款语句的颜色 - Woocommerce 产品页面
- java - 在测试主题类中调用 Mockbean 不会抛出错误
- django - 如何让 celerybeat cron 任务在 django 应用程序的 docker 容器中运行?
- sql - SQL CASE 语句和多个条件
- r - 在 data.table 中对两组 i 和 by 应用 j
- javascript - jQuery 多处理范围滑块休闲到处理程序
- ios - iOS后台上传 - 如何处理过期的身份验证令牌
- vue.js - vue-chartjs 无法显示标签和数据集
- c++ - 光线追踪/Phong 模型漫反射组件