I love interactive pivot tables. That is the number one reason why I keep using spreadsheet software. The ability to look at data quickly in lots of different ways, without a single line of code helps me to get an understanding of the data really fast.

Perhaps I can do the same now in R as well. At yesterday's LondonR meeting Enzo Martogliopresented briefly his rpivotTable package. Enzo builds on Nicolas Kruchten's PivotTable.jsJavaScript library that provides drag'n'drop functionality and wraps it with htmlwidget into R. The result is an interactive pivot table rendered in either your default browser or the viewer pane of RStudio with one line of code:

## Install packages
library(devtools)
install_github("ramnathv/htmlwidgets")
install_github("smartinsightsfromdata/rpivotTable")
## Load rpivotTable
library(rpivotTable)
data(mtcars)
## One line to create pivot table
rpivotTable(mtcars, rows="gear", col="cyl", aggregatorName="Average",
vals="mpg", rendererName="Treemap")

The following animated Gif from Nicolas' project page gives an idea of the interactive functionality of PivotTable.js.

Example of PivotTable.js Source: Nicolas Kruchten

Session Info

R version 3.1.3 (2015-03-09)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.2 (Yosemite) locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages:
[1] stats graphics grDevices utils
[5] datasets methods base other attached packages:
[1] rpivotTable_0.1.3.4 loaded via a namespace (and not attached):
[1] digest_0.6.8 htmltools_0.2.6
[3] htmlwidgets_0.3.2 RJSONIO_1.3-0
[5] tools_3.1.3 yaml_2.1.13
转自:http://www.magesblog.com/2015/03/pivot-tables-with-r.html

Interactive pivot tables with R(转)的更多相关文章

  1. 转 Refresh Excel Pivot Tables Automatically Using SSIS Script Task

    Refresh Excel Pivot Tables Automatically Using SSIS Script Task https://www.mssqltips.com/sqlservert ...

  2. Find modern, interactive web-based charts for R at the htmlwidgets gallery

    While R's base graphics library is almost limitlessly flexible when it comes to create static graphi ...

  3. Shiny for Interactive Application Development using R(转)

    This slidify-based deck introduces the shiny package from R-Studio and walks one through the develop ...

  4. Beautiful and Powerful Correlation Tables in R

    Another correlation function?! Yes, the correlation function from the psycho package. devtools::inst ...

  5. The leaflet package for online mapping in R(转)

    It has been possible for some years to launch a web map from within R. A number of packages for doin ...

  6. Graphics for R

    https://cran.r-project.org/web/views/Graphics.html CRAN Task View: Graphic Displays & Dynamic Gr ...

  7. R2—《R in Nutshell》 读书笔记(连载)

    R in Nutshell 前言 例子(nutshell包) 本书中的例子包括在nutshell的R包中,使用数据,需加载nutshell包 install.packages("nutshe ...

  8. 10分钟学习pandas

    10 Minutes to pandas This is a short introduction to pandas, geared mainly for new users. You can se ...

  9. 转:Busy Developers' Guide to HSSF and XSSF Features

    Busy Developers' Guide to Features Want to use HSSF and XSSF read and write spreadsheets in a hurry? ...

随机推荐

  1. 文本挖掘预处理之向量化与Hash Trick

    在文本挖掘的分词原理中,我们讲到了文本挖掘的预处理的关键一步:"分词",而在做了分词后,如果我们是做文本分类聚类,则后面关键的特征预处理步骤有向量化或向量化的特例Hash Tric ...

  2. Azure Messaging-ServiceBus Messaging消息队列技术系列8-服务总线配额

    上篇博文中我们介绍了Azure ServiceBus Messaging的消息事务机制: Azure Messaging-ServiceBus Messaging消息队列技术系列7-消息事务(2017 ...

  3. activiti 一个流程的运转步骤 以请假流程为例

    ---为了加深对activiti的理解记忆,对自己做的一个流程进行自述.加强记忆 请假实例 一.设计请假的流程图以及流程文件,完善对应数据项,比如用户信息,请假单信息 --请假单 --流程图 --流程 ...

  4. c++中enum的用法——枚举类型

    将变量的可取值全部列举出来,写在程序的开头,使用该类型的时候显示地指定取值即可(即对枚举变量进行赋予元素操作,这里之所以叫赋元素操作不叫赋值操作就是为了说明枚举变量是不能直接赋予算数值的). 如: e ...

  5. 转账示例(三):service层面实现(线程管理Connection)(本例采用QueryRunner来执行sql语句,数据源为C3P0)

    缺点:Service层面还是不应该出现关于事务的操作1.自行创建C3P0Uti,account数据库,导入Jar包 2.Dao层面 接口: package com.learning.dao; impo ...

  6. Doctype 文档类型,标准模式,混杂模式

    HTML4.01和XHTML1.0 基于 SGML,支持DTD声明,HTML5不是,但是需要 doctype 来规范浏览器的行为. 标准模式是指,DTD声明定义了标准文档的类型后,浏览器按W3C标准解 ...

  7. mysql性能优化配置总结

    看了一些优化mysql运维的一些书籍,在此记录总结下:进入mysql客户端输入以下sql:1.连接设置 show variables like '%max_connection%'; show sta ...

  8. Azure IoT 技术研究系列4-Azure IoT Hub的配额及缩放级别

    上两篇博文中,我们介绍了将设备注册到Azure IoT Hub,设备到云.云到设备之间的通信: Azure IoT 技术研究系列2-设备注册到Azure IoT Hub Azure IoT 技术研究系 ...

  9. [Linux] PHP程序员玩转Linux系列-升级PHP到PHP7

    1.PHP程序员玩转Linux系列-怎么安装使用CentOS 2.PHP程序员玩转Linux系列-lnmp环境的搭建 3.PHP程序员玩转Linux系列-搭建FTP代码开发环境 4.PHP程序员玩转L ...

  10. Linux--谈父子进程执行过程

    fork函数用于从已存在进程中创建一个新进程,新进程成为子进程,原进程成为父进程.这两个进程分别返回他们各自的返回值, 其中父进程的返回值是子进程的进程号,子进程则返回0,因此返回值大于0标识父进程, ...