if (FALSE) {
# example proto file supplied with this package
proto.file <- system.file( "proto", "addressbook.proto", package = "RProtoBuf" )
# reading a proto file and creating the descriptor
Person <- P( "tutorial.Person", file = proto.file )
}
Person <- P( "tutorial.Person" )
# enum type
Person$PhoneType
# enum value type
value(Person$PhoneType, 1)
name(value(Person$PhoneType, 1))
name(value(Person$PhoneType, 1), TRUE)
number(value(Person$PhoneType, number=1))
enum_type(value(Person$PhoneType, number=1))
Run the code above in your browser using DataLab