Interactive pivot tables with R(转)

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
时间: 2024-10-03 20:41:01

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

转 Refresh Excel Pivot Tables Automatically Using SSIS Script Task

Refresh Excel Pivot Tables Automatically Using SSIS Script Task https://www.mssqltips.com/sqlservertip/5946/refresh-excel-pivot-tables-automatically-using-ssis-script-task/ 原文地址:https://www.cnblogs.com/Tonyyang/p/10468749.html

Shiny for Interactive Application Development using R(转)

This slidify-based deck introduces the shiny package from R-Studio and walks one through the development of an interactive application that presents users with options to subset the iris dataset, generate a summary of the resulting dataset, and deter

R语言学习资源

入门视频教程 R语言初级课程(1)- R语言快速入门http://cos.name/videos/intro-2-r/ 代码 #对象 1+1*3 c(1,2,3,4,5) c('helloworld','i am a R user') c("hehe","haha") 1:6 6:1 exp(1:4) log(1:3) a<-c(1,2,3,4,5) a[1] a[1:3] a[-4] a>3 a[a>3] #数组,类型需要一致 x<-1:1

《R in Nutshell》 读书笔记(连载)

R in Nutshell 前言 例子(nutshell包) 本书中的例子包括在nutshell的R包中,使用数据,需加载nutshell包 install.packages("nutshell") 第一部分:基础 第一章 批处理(Batch Mode) R provides a way to run a large set of commands in sequence and save the results to a file. 以batch mode运行R的一种方式是:使用系统

【Python语言】十分钟搞定pandas

本文是对pandas官方网站上<10 Minutes to pandas>的一个简单的翻译,原文在这里.这篇文章是对pandas的一个简单的介绍,详细的介绍请参考:Cookbook .习惯上,我们会按下面格式引入所需要的包: 一.            创建对象 可以通过 Data Structure Intro Setion 来查看有关该节内容的详细信息. 1.可以通过传递一个list对象来创建一个Series,pandas会默认创建整型索引: 2.通过传递一个numpy array,时间索

The Top 50 Proprietary Programs that Drive You Crazy — and Their Open Source Alternatives

The Top 50 Proprietary Programs that Drive You Crazy - and Their Open Source Alternatives 01 / 22 / 2013 By Josh Weikel No Comments Posted in Software Tags Update January 22, 2013: This article was originally posted February 7, 2008. Since then, it h

Python大数据处理模块Pandas

Python大数据处理模块Pandas [这篇转载自CSDNchengxuyuanyonghu的博客:http://blog.csdn.net/chengxuyuanyonghu/article/details/54956207] 目录 读取数据 索引 选择数据 简单运算 import pandas as pd read_csv to_csv 数据框操作 一            创建对象 二            查看数据 三            选择 四            缺失值处理

10种简单的Java性能优化(转)

本文由 ImportNew - 一直在路上 翻译自 jaxenter.欢迎加入翻译小组.转载请见文末要求. 你是否正打算优化hashCode()方法?是否想要绕开正则表达式?Lukas Eder介绍了很多简单方便的性能优化小贴士以及扩展程序性能的技巧. 最近"全网域(Web Scale)"一词被炒得火热,人们也正在通过扩展他们的应用程序架构来使他们的系统变得更加"全网域".但是究竟什么是全网域?或者说如何确保全网域? 扩展的不同方面 全网域被炒作的最多的是扩展负载(

学习linux命令,看这篇2w多字的linux命令详解

用心分享,共同成长 没有什么比每天进步一点点更重要了 本文已收录到我的github:https://github.com/midou-tech/articles/tree/master/docs/linux ,欢迎star和issues. 序言 ?本篇文章主要讲解了一些linux常用命令,主要讲解模式是,命令介绍.命令参数格式.命令参数.命令常用参数示例.由于linux命令较多,我还特意选了一些日常使用较为频繁的命令进行讲解,但还是免不了文章很长,建议大家收藏起来,用到的时候不会了再来阅读.当然