-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
On SO, I found myself doing...
trial = c("9-5", "7-5", "13-3", "17-6")
wdays = c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
setDT(tstrsplit(trial, "-", type.convert=TRUE))[,
paste0(wdays[V2 + 1], " ", V1, ":00")
]
It would be nice if I could instead do
with( tstrsplit(trial, "-", type.convert=TRUE, list.names=TRUE),
paste0(wdays[V2 + 1], " ", V1, ":00")
)
so V1
, V2
, etc are the names in the result.
The list.names
arg could be extended to specify other naming rules as well.