Console text truncation in tibbles

I'm having some trouble with console outputs. I think this is a recent development, but I'm not sure.

I work with a lot of text-heavy columns; many of the values are entire paragraphs. Lately, I can't get the entire string to print to the console when it's in a tibble; I've tried changing the Tools > Global Options > Display > Console: Limit Length of Lines Displayed, and also tried changing various tibble print options, but I don't think they necessarily apply to this problem so none of these things have helped.

I would like to be able to get the entire text block to print, since sometimes I like to read the entire block to check for things, and there does not seem to be an option to resize rows in the Viewer (in any case, this is less desirable; I'd just like to be able to print selected rows and scan them quickly in the console). Reprex below. I've tried searching for truncation problems (a lot of the hits are about integers/doubles), but can't seem to find anything relevant.

library(tidyverse)

one <- c("this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text", "another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph ")

index <- c(1,2)

test <- data.frame(index, one, stringsAsFactors = FALSE)

head(test)
#>   index
#> 1     1
#> 2     2
#>                                                                                                                                                                                                                                                                             one
#> 1 this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text
#> 2                                                               another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph

ttest <- as.tibble(test)
head(ttest)
#> # A tibble: 2 x 2
#>   index one                                                               
#>   <dbl> <chr>                                                             
#> 1  1.00 this is a large block of text this is a large block of text this …
#> 2  2.00 "another test paragraph another test paragraph another test parag…

ttest[1,2]
#> # A tibble: 1 x 1
#>   one                                                                     
#>   <chr>                                                                   
#> 1 this is a large block of text this is a large block of text this is a l…

Created on 2018-04-11 by the reprex package (v0.2.0).

1 Like

There's an open issue for this in pillar (which deals with printing of tibbles):

Ok, thanks. I'd also be curious to know how others are getting around this for now.

My workaround is to wrap c around it.

c(ttest[1,2])

1 Like

Except for printing a limited number of rows, I find all of the other tibble print output formatting intrusive and annoying. For the moment, my workaround is a function h that prints ten rows by default, but otherwise prints output in the same way as for regular data frames:

h = function(data, n=10) as.data.frame(head(data,n))
h(ttest)  # or ttest %>% h

index
1 1
2 2
one
1 this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text this is a large block of text
2 another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph another test paragraph

1 Like