r - 为什么 tidyr extract 不尊重 ignore_case 标志?
问题描述
我希望我可以将 a 传递regex
给 tidyrextract
并将其设置ignore_case
为 true。但它显然不起作用:
tidyr::extract(
tibble("Value"),
col = 1,
into = c("result"),
regex = regex("(value)", ignore_case = TRUE)
)
这应该会产生一个包含一列result
和一行 value的 tibble Value
。但事实并非如此,细胞是NA
.
使用大写字母时,相同的代码可以工作:
tidyr::extract(
tibble("Value"),
col = 1,
into = c("result"),
regex = regex("(Value)", ignore_case = TRUE)
)
传递ignore_case = TRUE
orignore.case = TRUE
直接作为参数extract
并不能解决问题。
解决方案
Thx wiktor,确实有效:
tidyr::extract(
tibble("Value"),
col = 1,
into = c("result"),
regex = "(?i)(value)"
)
推荐阅读
- gcc - clang:fdebug-prefix-map 如何使用相对于用户主路径`~`的新路径?
- eclipse - 如何将 RunToLine 作为 actionSet 添加到我的自定义透视外观?
- amazon-s3 - JupyterHub 服务器无法在私有子网中运行的 Terraformed EMR 集群中启动
- javascript - React/React Hooks:用于更改文本的 onChange 函数正在同时更改所有 3 个元素,而不仅仅是一个
- javascript - 有没有办法在 Javascript 中打开 tcp 套接字连接?
- sql - SQL Visual Studio 如何使大纲切换框出现?
- go - Goland IDE - 测试覆盖率
- c++ - 使用 C++ 的 openssl 3des
- java - 我的变量 loginSuccesful 自动更改
- php - PHP:对象实例上的 new 运算符创建一个对象实例。为什么?