Skip to content

Commit 4af716e

Browse files
committed
simplicfication of the function
1 parent a5cee54 commit 4af716e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

data-raw/create_test_guides.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ write_yaml_mod <- function(x, file) {
1616
newtxt <- c()
1717
for (line in txt) {
1818
if (any(stringr::str_detect(line, "(ranges|cells): .+$"))) {
19-
space <- stringr::str_extract(line, "(\\s+)(ranges:|cells:)\\s+(.+)$", group=1)
20-
label <- stringr::str_extract(line, "(\\s+)(ranges:|cells:)\\s+(.+)$", group=2)
21-
value <- stringr::str_extract(line, "(\\s+)(ranges:|cells:)\\s+(.+)$", group=3)
19+
matches <- stringr::str_match(line, "(\\s+)(ranges:|cells:)\\s+(.+)$")
20+
space <- matches[, 2]
21+
label <- matches[, 3]
22+
value <- matches[, 4]
2223
newtxt <- c(newtxt, paste0(space, label))
2324
newtxt <- c(newtxt, paste0(space, " - ", value))
2425
} else {

0 commit comments

Comments
 (0)