This is the documented behavior since r35262 (2005), from ?format

> If x is a list, the result is a character vector obtained by applying 
> format.default(x, ...) to each element of the list

One consequence is that we can't add "nice" printing methods for
list-of-object columns in data.frames:

https://github.com/eddelbuettel/rprotobuf/issues/109

library(RProtoBuf)
person_desc <- P("tutorial.Person")
DF <- data.frame(id = 1:2)
DF$person = list(person_desc$new(name = "Me"), person_desc$new(name =
"You", email = "y...@u.com"))

DF
#   id                                                  person
# 1  1 <S4 class ‘Message’ [package “RProtoBuf”] with 2 slots>
# 2  2 <S4 class ‘Message’ [package “RProtoBuf”] with 2 slots>
             ^ from format.default, with option to make it more informative

One assumes that at this point, there are back-compatibility concerns
since this is the documented behavior.

Is there no other option than to make the 'person' column itself an S3
class with an associated format method?

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to