变换不适用于每一行
Transmutation Does not Apply to Each Row
我正在使用 tidyverse 和 rvest。
我创建了一个只有一列的标题;一系列包含 HTML markdown 的字符串。我试图遍历每一个并从字符串中过滤掉降价。这似乎是 Transmute 和 rvest 的正确用法 read_html/html_text:
transmute(responses, response_stripped = html_text(read_html(response_content)))
它确实很好地过滤了第一行。但是,它随后会获取该结果并对后面的每一行重复该结果,而不是单独处理它们。
response_stripped
<chr>
1 The only real branch points that lead me to the right diagnosis occurred after disc…
2 The only real branch points that lead me to the right diagnosis occurred after disc…
3 The only real branch points that lead me to the right diagnosis occurred after disc…
知道为什么会这样吗?
在转换之前尝试使用 dplyr::rowwise()
。
我正在使用 tidyverse 和 rvest。
我创建了一个只有一列的标题;一系列包含 HTML markdown 的字符串。我试图遍历每一个并从字符串中过滤掉降价。这似乎是 Transmute 和 rvest 的正确用法 read_html/html_text:
transmute(responses, response_stripped = html_text(read_html(response_content)))
它确实很好地过滤了第一行。但是,它随后会获取该结果并对后面的每一行重复该结果,而不是单独处理它们。
response_stripped
<chr>
1 The only real branch points that lead me to the right diagnosis occurred after disc…
2 The only real branch points that lead me to the right diagnosis occurred after disc…
3 The only real branch points that lead me to the right diagnosis occurred after disc…
知道为什么会这样吗?
在转换之前尝试使用 dplyr::rowwise()
。