Bug 15915 - View() and nested data frames
Summary: View() and nested data frames
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: R 3.1.0
Hardware: All All
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-07-30 10:43 UTC by Jeroen
Modified: 2015-11-27 19:30 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen 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.