df1 <- tibble::tribble(
~drone, ~selfpilot,
"0.09 (0.21)", "0.19 (0.13)",
"0.19 (0.28)", "0.53 (0.10)",
"0.62 (0.16)", "0.50 (0.11)",
"0.15 (0.35)", "0.57 (0.16)",
)
df1 |>
split_by_parens()
# Only some columns:
df1 |>
split_by_parens(cols = drone)
# Longer format:
df1 |>
split_by_parens(transform = TRUE)
# Other suffixes:
df1 |>
split_by_parens(end1 = "beta", end2 = "se")
# Other delimiters:
df2 <- tibble::tribble(
~drone, ~selfpilot,
"0.09 [0.21]", "0.19 [0.13]",
"0.19 [0.28]", "0.53 [0.10]",
)
df2 |>
split_by_parens(delim = "brackets")
df3 <- tibble::tribble(
~drone, ~selfpilot,
"0.09 <0.21>", "0.19 <0.13>",
"0.19 <0.28>", "0.53 <0.10>",
)
df3 |>
split_by_parens(delim = c("<", ">"))
Run the code above in your browser using DataLab