Initialize an empty tibble with column names and 0 rows
16:26 16 Feb 2018

I have a vector of column names called tbl_colnames.

I would like to create a tibble with 0 rows and length(tbl_colnames) columns.

The best way I've found of doing this is...

tbl <- as_tibble(data.frame(matrix(nrow=0,ncol=length(tbl_colnames)))

and then I want to name the columns so...

colnames(tbl) <- tbl_colnames.

My question: Is there a more elegant way of doing this?

something like tbl <- tibble(colnames=tbl_colnames)

r tibble