Bug 15915

Summary: View() and nested data frames
Product: R Reporter: Jeroen Ooms <jeroen>
Component: MiscAssignee: R-core <R-core>
Status: CLOSED FIXED    
Severity: enhancement CC: murdoch
Priority: P5    
Version: R 3.1.0   
Hardware: All   
OS: All   

Description Jeroen Ooms 2014-07-30 10:43:22 UTC
The utils::View function has difficulty showing nested data frames. For example:

  test <- data.frame(x=1:5)
  test$y <- data.frame(foo=rnorm(5), bar=rnorm(5))
  print(test)
  View(test)

Such nested data frames frequently appear when working with JSON data from the web. It would be great if the output of View() would be similar to print().

One easy fix would be to edit utils::View and replace

  x <- lapply(x0, as.num.or.char)

with 

  x <- as.list(format.data.frame(x0))

The format.data.frame function is used by print.data.frame as well to prepare the data frame for display, including flattening any nested data frames.
Comment 1 Duncan Murdoch 2015-11-27 19:30:25 UTC
Fixed in R-devel r69711, soon in R-patched.