I invite you to check out the main page for protobuf to find the language definition for protocol buffers as well as tutorial for officially (i.e. by google) supported languages (python, c++ and java) as well as the third party support page that lists language bindings offered by others (including our
Protocol buffers are a language agnostic data interchange format, based on a using a simple and well defined language. Here comes the classic example that google uses for C++, java and python tutorials.
First, the proto file defines the format of the message.
Then you need to teach this particular message to R, which is simply done by the
> readProtoFiles( "addressbook.proto" )
Now we can start creating messages :
And then access, modify fields of the message using a syntax extremely close to R lists> person$email person$name
In R, protobuf messages are stored as simple S4 objects of class "Message" that contain an external pointer to the underlying C++ object. The Message class also defines methods that can be accessed using the dollar operator> # write a debug version of message > # this is not how it is serialized > writeLines( person$toString() ) name: "Romain Francois" id: 1234 email: "firstname.lastname@example.org" > # serialize the message to a file > person$serialize( "somefile" )
The package already has tons of features, detailed in the vignette> vignette( "RProtoBuf" )
.. and there is more to come