Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dump() function producing truncated output

Tags:

r

I would like your help figuring out why the dump function truncates long outputs, and what can be done to avoid this behavior. By "truncated", I mean that the function displays ... rather than printing a full representation of the object.

This is a big concern because it renders some packages like svSocket unusable. The package relies on fully sourceable dumps as a means to send objects between R sessions.

I am seeing this issue on a linux platform (x86_64-pc-linux-gnu) but not on a mac (x86_64-apple-darwin15.6.0), both using the latest version of R (3.4.1)

Here is reproducible example:

x <- as.list(1:200)
dump("x", stdout())

The output is:

list(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 
    14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 
    26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 
    38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 
    50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 
    62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 
    74L, 75L, 76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 
    86L, 87L, 88L, 89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 
    98L, 99L, 100L, 101L, 102L, 103L, 104L, 105L, 106L, 107L, 
    108L, 109L, 110L, 111L, 112L, 113L, 114L, 115L, 116L, 117L,
  ...
like image 705
flodel Avatar asked Aug 13 '26 21:08

flodel


1 Answers

Most likely, it is because options(deparse.max.lines) has been set; as of R version 3.3.2, dump() honors that option setting since it is considered a "deparsing activity".

As for svSocket, it really ought not to be using dump for passing data; generally speaking, serialize/unserialize is the preferred method for this.

like image 196
B. Tyner Avatar answered Aug 15 '26 11:08

B. Tyner