I have some data.tables containing file names as a var named fn. I want to split off basename and extension:
fn
library(data.table) library(tools)
Already fixed
library(data.table) library(tools) DT1 = data.table(fn = c("gah.csv", "egad.csv")) do_split_fn_dot = quote(c("name", "ext") := .(file_path_sans_ext(fn), file_ext(fn))) DT1[, eval(do_split_fn_dot)] DT1 # fn name ext #1: gah.csv gah csv #2: egad.csv egad csv