-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
Just came across a situation where I want to use a named vector in a way most easily handled by a join, but unfortunately:
join_vector <- c("id1"=1, "id2"=2, "id3"=3)
setDT(join_vector, keep.rownames=T)
Is an error: Argument 'x' to 'setDT' should be a 'list', 'data.frame' or 'data.table'
However, first casting join_vector as a data.frame works:
setDT(data.frame(join_vector), keep.rownames=T)
(though this returns an invisible object, since data.frame(join_vector) isn't assigned to anything).
Is there any reason not to allow setDT to re-class vectors like the above?