[Rprotobuf-yada] Some help wanted

David Ibarra Gómez dibarra at aqualogy.net
Tue Feb 5 13:32:37 CET 2013


Hello,

                I'm using RProtobuf (on Debian Wheezy, R version 2.14.1 (2011-12-22), just downloaded RProtobuf).

I'm using this proto file:

message caudal{
        required uint32 id = 1;
        required string signo =2;
        optional string s_id =3;
}
message sector{
        required string nombre=1;
        required string nombre_abreviado=2;
        required string gerencia = 3;
        required uint32 activo=4;
        required string literal = 5;
        repeated caudal caudales = 6;
}
message explotacion{
        required string nombre =1;
        repeated sector sectores =2;
}

I'm putting data inside a proto from a data.frame that I read from CSV (by the way I suppose it's not the best option but nevertheless I try). But I'm not able to use correctly the add method (for adding a repeated message):

sectores <-new(explotacion,nombre="SB")
conjunto<-seq(1,length(gerencias[,1]))

for(i in conjunto){
                sectorini <-new(sector,
                               nombre=as.character(gerencias[i,]$NOM.SECTOR),
                               nombre_abreviado=as.character(gerencias[i,]$ABREVIAT),
                               gerencia = as.character(gerencias[i,]$GERENCIA),
                               activo = as.numeric(gerencias[i,]$codi),
                               literal = as.character(gerencias[i,]$LITERAL.FUNCI)
                                               )
                sectores$add("caudal",sectorini)
}

I get "Error in add(x, ...) : could not get FieldDescriptor for field"

Could you please help me to use that add function: "sectores$add("caudal",sectorini)"

Thank you


David


________________________________
Disclaimer: http://disclaimer.aqualogy.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rprotobuf-yada/attachments/20130205/9b3b9b5c/attachment.html>


More information about the Rprotobuf-yada mailing list