A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/eddelbuettel/rprotobuf/issues/13 below:

0-length character vector is restored as 0-length logical vector · Issue #13 · eddelbuettel/rprotobuf · GitHub

Originally I found a problem trying to send a 0-row data.frame with character row.names through RProtobuf:

> x <- data.frame(A=1:3,B=1:3, row.names=c("apples","oranges","bananas"))
> x <- x[x$A > 5, ]
> serialized <- RProtoBuf::serialize_pb(object=x, connection=NULL)
> y <- RProtoBuf::unserialize_pb(serialized)
Error in attributes(xobj) <- attrib : 
  row names must be 'character' or 'integer', not 'logical'

Then I observed that the problem was in the row.names attr of the data.frame, because a 0-length character vector turns into a 0-length logical vector.

> x <- character(0)
> serialized <- RProtoBuf::serialize_pb(object=x, connection=NULL)
> y <- RProtoBuf::unserialize_pb(serialized)
> y
logical(0)

The problem occurs in both the CRAN version (0.4.3) and the Github master code.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4