0

I have an input that is like:

library(tibble)
input = as.tibble(["test1/data/data.rds", "test1/settings/setting.txt", "test2/stuff.rds"])

I am trying to turn this into a table with multiple columns so I want:

test1 | data | data.rds
test1 | settings | setting.txt
test2 | stuff.rds | NA

I can split the data by:

library(stringr)
split = stringr::str_split(input$value, '/')

that gives me a list of character vectors.

result = as_tibble(split)

gives me back a one column frame of character vectors rather than a multi-column construct?

What do I need to do to make it multi column? Blanks should be NAs.

This is different from previous questions because the number of columns is variable and not fixed

KillerSnail
  • 3,321
  • 11
  • 46
  • 64

0 Answers0