-1

I would excpect that I can pass a regex to tidyr's extract and set the ignore_case to true. But it does not work apparently:

tidyr::extract(
  tibble("Value"),
  col = 1,
  into = c("result"),
  regex = regex("(value)", ignore_case = TRUE)
)

This should result in a tibble with one column result and one row with value Value. But it does not, the cell is NA.

With a capital letter, the same code works:

tidyr::extract(
  tibble("Value"),
  col = 1,
  into = c("result"),
  regex = regex("(Value)", ignore_case = TRUE)
)

Passing ignore_case = TRUE or ignore.case = TRUE directly as an argument to extract does not solve the problem.

benjazehr
  • 145
  • 1
  • 7

1 Answers1

-1

Thx wiktor, that works indeed:

tidyr::extract(
  tibble("Value"),
  col = 1,
  into = c("result"),
  regex = "(?i)(value)"
)
benjazehr
  • 145
  • 1
  • 7