I am trying to initialise an empty tibble, with column names column types already specified.
code below successfully initialise an empty tibble with names
coltest <-
c("exectime", "jancode", "publisher_code", "price_a", "price_b", "title",
"date", "star", "purchase", "caption", "reviewer", "comment", "item_info")
dd <- matrix(ncol = 13, nrow = 0) %>% as.data.frame() %>% as_tibble
colnames(dd) <- coltest
I then try to convert all columns to specific types using read::type_convert() shorthand
dd %>% type_convert(dd, col_types = "tcfnnfDcfcfcc")
This gives error,
Error in substring(col_types, idx, idx) : invalid substring arguments
What am I doing wrong?