When the strings represent numbers, it's better to read them in as a character vector using aoc_input_vector()
, then change mode to numeric as part of call to split_at_blanks()
.
Usage
split_at_blanks(lines, mode = c("character", "numeric"), split = "")
Examples
x <- c("123", "1234", "", "56", "567", "", "89")
split_at_blanks(x)
#> $`1`
#> [1] "123" "1234"
#>
#> $`2`
#> [1] "56" "567"
#>
#> $`3`
#> [1] "89"
#>
split_at_blanks(x, "numeric")
#> $`1`
#> [1] 123 1234
#>
#> $`2`
#> [1] 56 567
#>
#> $`3`
#> [1] 89
#>