mongo.bson.from.df: Convert a data.frame to a mongo.bson object

Description Usage Arguments Details Value See Also Examples

View source: R/bson_convert.R

Description

Convert a data.frame to a mongo.bson object.

Usage

1

Arguments

df

(data.frame) The data.frame to convert.

This must be a data.frame, not a vector of atomic types; otherwise, an error is thrown; use as.data.frame() as necessary.

Details

This function permits the simple and convenient creation of a mongo.bson object. This bypasses the creation of a mongo.bson.buffer, appending fields one by one, and then turning the buffer into a mongo.bson object with mongo.bson.from.buffer().

Value

(mongo.bson) A mongo.bson object serialized from data.frame.

See Also

mongo.bson.to.list,
mongo.bson,
mongo.bson.destroy.

Examples

1
2
df <- data.frame(name=c("John", "Peter"), age=c(32,18))
b <- mongo.bson.from.df(df)

jonkatz2/rmongodb documentation built on May 19, 2019, 7:30 p.m.