data.frames will form row names from the names of vector inputs.
data.frame(
x = setNames((1:12) ^ 3, month.abb)
)
I expected data.table to do something similar when keep.rownames = TRUE. That is I expected that these two pieces of code would be equivalent:
data.table(
x = setNames((1:12) ^ 3, month.abb),
keep.rownames = TRUE
)
data.table(
rn = month.abb,
x = (1:12) ^ 3
)
Currently keep.rownames = TRUE seems to only apply to matrix or data.frame inputs, rather than vectors. Changing the behavior so that keep.rownames = TRUE mimics data.frame behavior seems desirable.
data.frames will form row names from the names of vector inputs.I expected
data.tableto do something similar whenkeep.rownames = TRUE. That is I expected that these two pieces of code would be equivalent:Currently
keep.rownames = TRUEseems to only apply to matrix or data.frame inputs, rather than vectors. Changing the behavior so thatkeep.rownames = TRUEmimicsdata.framebehavior seems desirable.