The first example:
nn = runif(c(a=0.1, b=0.2, c=0.3, d=0.4))
as.data.table(nn)
as.data.table(nn, keep.rownames=TRUE)
as.data.table(nn, keep.rownames="rownames")
Presumably we're passing a named vector to runif in order to show the use of keep.rownames... but this is not what we get. runif strips the names of the output:
runif(c(a=0.1, b=0.2, c=0.3, d=0.4))
# [1] 0.02227326 0.41916132 0.26085452 0.69217186
I guess we should just remove runif? The point is to show what as.data.table.numeric does, presumably, and as.data.table(c(a=0.1, b=0.2, c=0.3, d=0.4)) should suffice here.
The first example:
Presumably we're passing a named vector to
runifin order to show the use ofkeep.rownames... but this is not what we get.runifstrips the names of the output:I guess we should just remove
runif? The point is to show whatas.data.table.numericdoes, presumably, andas.data.table(c(a=0.1, b=0.2, c=0.3, d=0.4))should suffice here.