Skip to content

Typo (?) in as.data.table example #1576

@MichaelChirico

Description

@MichaelChirico

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions