listviewer

421 篇文章 15 订阅

Last week’s exportwidget got almost no love, so I’m hoping this one finds a loving home. I have not been able to stop using it, since the first hour of creation, so it has quickly become a key component in my workflow.

With a tweet, Jennifer Bryan inspired this widget. Nested data gets messy, inscrutable, and difficult to follow very quickly. lists and environments in R are the primary source of this nested data. Often, an interactive visual look provides the insight and understanding one needs. listviewergives us this view with just one line of code. We can use it to inspect htmlwidgets or latticeplots or par() settings or your .GlobalEnv.

Thanks so much to the Jos de Jong, the author of jsoneditor on which listviewer relies for all its awesomeness. If you look at the source of listviewer, you will notice how little code I had to write to wrap this as an htmlwidget.

Quick Installation

As with almost all widgets posted here, listviewer is not on CRAN, so for now please install withdevtools::install_github. Given enough interest, I’m happy to put in the effort to make this or any others CRAN-worthy. Just let me know.

devtools::install_github(c(
  'jeroenooms/jsonlite'
  , 'rstudio/shiny'
  , 'ramnathv/htmlwidgets'
))

Examples

What’s my par?

When I first learned R I struggled with all the stuff in par(). Let’s see if this makes a little more sense.

library(listviewer)

jsonedit( par() )

What’s in my lattice?

lattice plots become trellis objects. Let’s peek inside. If you’re thinking let’s do the same withggplot2, you’ll need to write a little more code to handle S3S4, and environments.

library(lattice)
library(listviewer)

jsonedit(
  xyplot( y~x, data.frame( x = 1:10, y = 1:10 ), type = "b" )
)

What’s in my broom?

David Robinson’s broom package tidies up our messy data in R. Let’s see the difference withjsonedit.

jsonedit(
  list(
    "messy" = lm(mpg~factor(cyl),mtcars)
    ,"broom" = list(
      "tidy" = broom::tidy(lm(mpg~factor(cyl),mtcars))
      ,"augment" = broom::augment(lm(mpg~factor(cyl),mtcars))
    )
  )
)

What’s in my htmlwidget?

I hope you can see some of the power of this htmlwidget. As a final example, let’s go meta andjsonedit our jsonedit.

library(listviewer)

jsonedit(jsonedit())

Shiny?

listviewer sort of works with Shinymodify and save for listviewer is the next frontier. See the Readme.md.

Thanks

Thanks so much

  • jsoneditor from Jos de Jong
  • Ramnath Vaidyanathan and RStudio for htmlwidgets
  • all the contributors to R and JavaScript
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值