dt_separate doesnt work
acpguedes opened this issue · 1 comments
acpguedes commented
Follow the code
library(tidyfast)
my_parser <- function(data, var ){
dt_separate(data, col = var , into = c("key", "value"), sep = ":") #%>%
}
data.table::data.table(
a1 = purrr::map2(letters[1:20], LETTERS[20:1], ~ paste(.x, .y, sep = ":"))
) -> myDT
myDT
#> a1
#> 1: a:T
#> 2: b:S
#> 3: c:R
#> 4: d:Q
#> 5: e:P
#> 6: f:O
#> 7: g:N
#> 8: h:M
#> 9: i:L
#> 10: j:K
#> 11: k:J
#> 12: l:I
#> 13: m:H
#> 14: n:G
#> 15: o:F
#> 16: p:E
#> 17: q:D
#> 18: r:C
#> 19: s:B
#> 20: t:A
my_parser(myDT, a1)
#> Error in as.character(x): cannot coerce type 'closure' to vector of type 'character'
dt_separate(myDT, col = a1 , into = c("key", "value"), sep = ":")
Created on 2020-12-30 by the reprex package (v0.3.0)
A related one: hope-data-science/tidyfst#10
TysonStanley commented
Thanks. Will be updating the function in just a moment and will highlight how to use it within a function.