smartinsightsfromdata / rpivottable Goto Github PK
View Code? Open in Web Editor NEWA R wrapper for the great library pivottable
License: Other
A R wrapper for the great library pivottable
License: Other
I would like to know what are the functions to use renderChart2
and showOutput('name','rpivotTable')
are these active in rpivotTableOutput? They don't seem to make a difference. Is there another way to control the size of the table?
rpivottable is exposing the tables with a drag'n'drop UI around it, using pivotUI(). Is there any way to remove the UI interface, essentially using pivottable.js pivot() ?
@steadyfish @King23 I would appreciate your input (as well as the input of anybody else of course) as users of this package and especially of this functionality.
The way that pivottable
makes the continuos programming of the pivot table possible is through a parameter called overwrite
. In Nicolas words:
overwrite
is a boolean defaulting to false which controls what happens if this function is called repeatedly on the same element. If set to true, the options object overwrites the current state of the UI. If set to false, only the input data set changes, and the state of the UI remains the same, unless this is the first call, at which point the UI will be set to the options
In fact, to make rpivotTable
programmable I simply "forced" a value of true
for overwrite
in the parameters list in the JS code.
In hindsight I sort of regret this approach, as prevents to do the opposite, sending different datasets keeping the metadata set constant.
Do you (or anybody else) see a problem if I bring this parameter into the rpivotTable
calling parameter set, possibly as:
rpivotTable(
Titanic,
rows = "Survived",
cols = c("Class","Sex"),
aggregatorName = "Sum as Fraction of Columns",
inclusions = list( Survived = list("Yes")),
exclusions= list( Class = list( "Crew")),
vals = "Freq",
rendererName = "Table Barnhart",
overwrite = TRUE
)
Probably to avoid to break existing working code the parameter default could be set to TRUE in any case.
Any comment is appreciate.
Just wanted to start by saying that this package is great! rpivotTable works so well within Rstudio - I'm just having some problems getting it to work with Shiny.
I'm using some of your code as a test (see below). The issue is that when I run the code a webpage appears but without the pivot table. I'm using R 3.2.0, shiny 0.11.1 and rpivotTable 0.1.3.5. I've tried uninstalling and then reinstalling everything but a pivot table still won't appear.
Has anyone else had shiny issues with rpivotTable 0.1.3.5? I think the issue could either be due to a problem in CSS (maybe it is creating a background in front of the table) or a version issue.
Any help would be amazing! Thanks.
library(shiny)
library(shinydashboard)
library(rpivotTable)
library(ggplot2)
data(diamonds)
header <- dashboardHeader(title = "Data Profiler")
sidebar <- dashboardSidebar()
body <- dashboardBody(
tags$head(tags$style(
type = 'text/css',
'#test{ overflow-x: scroll; }'
)),
rpivotTableOutput("test")
)
shinyApp(
ui = dashboardPage(
header, sidebar, body),
server = function(input, output) {
output$test <- rpivotTable::renderRpivotTable({
rpivotTable(data = diamonds)
})
}
)
rpivotTable(data = diamonds)
This is a proposal for all interested parties, but especially @jrowen, @timelyportfolio & @nicolaskruchten to see if this proposal may wet their appetite.
We have a decent pivottable
widget with rpivotTable
, based on pivottable.js
I recently discovered that there is a custom project based on pivottable.js
, that introduces handsontable
as the base table, and highchart
.
The NovixPivotJS project is currently possibly abandoned, but it represents undoubtedly an advance.
The main advantages of NovixPivotJS
vs. pivottable
are:
pivottable
: it is too dynamic. The presence of scroll bars would make it an ideal widget for jupyter (in R and Python) and shiny.handsontable
is a step improvement over existing tablepivottable
(i.e. in handsontable
)On the other hand the complexity of handling data entry, well familiar to @jrowen (and to me with my early experiments on handsontable), and the introduction of
highchartrepresent a level of complexity well beyond my meagre javascript skills. There would be also the additional core of maintaining alignment with
pivottable`.
A team effort would seems a good way forward, sort of bringing together some elements of rhandsontable and rpivottable (both packages would continue to make sense as specialised versions).
In an ideal world this would require:
NovixPivotJS
and maintain it in parallel to pivottable
evolutionsDoes it sound feasible and worth the effort?
Hi,
I am trying to use derivedAttributes
parameter but haven't been successful. Is it supported in the current version? Could you share an example if it is?
Here's the example I tried -
library(htmlwidgets)
library(rpivotTable)
df = data.frame(a = 1:10, b = 11:20)
my_func = JS("var c = function(record) {
return record.a / record.b;
}")
rpivotTable(df, derivedAttributes = my_func)
In the browser console I see this error -
SyntaxError: expected expression, got keyword 'var'
window.HTMLWidgets.evaluateStringMember() htmlwidgets.js:638
window.HTMLWidgets.staticRender/</<() htmlwidgets.js:532
forEach() self-hosted:216
forEach() htmlwidgets.js:55
window.HTMLWidgets.staticRender/<() htmlwidgets.js:466
forEach() self-hosted:216
forEach() htmlwidgets.js:55
window.HTMLWidgets.staticRender() htmlwidgets.js:464
htmlwidgets.js:544
I am trying to run a shiny app including a rpivottable.
my config: devtools 1.8.0, htmlwidgets 0.4.2, rpivotTable 0.1.4.1, shiny 0.12.0
R version 3.1.2 (2014-10-31)
Ubuntu 14.04.1 LTS
My code works perfectly locally, but on the server it crash and I get this error on the console:
TypeError: x is undefined
And it links to this code:
HTMLWidgets.widget({
name: 'rpivotTable',
type: 'output',
initialize: function(el, width, height) {
return {}
},
renderValue: function(el, x, instance) {
x.data = HTMLWidgets.dataframeToD3(x.data);
var derivers = $.pivotUtilities.derivers;
var tpl = $.pivotUtilities.aggregatorTemplates;
x.params.renderers = $.extend(
$.pivotUtilities.renderers,
$.pivotUtilities.d3_renderers,
$.pivotUtilities.c3_renderers
);
$('#'+el.id).pivotUI(
x.data, x.params
);
},
resize: function(el, width, height, instance) {
}
});
My R code is the following:
if (interactive()) { lib.path <- my.path.local
} else { lib.path <- my.path.server }
library(shiny, lib.loc = lib.path)
library(htmlwidgets, lib.loc = lib.path)
library(rpivotTable, lib.loc = lib.path)
data <- data.frame(var1 = c("mod1", "mod2"), value = c(1, 2))
shinyApp(
ui = fluidPage(
sidebarLayout(
sidebarPanel(
textOutput("config"), textOutput("path"), textOutput("version"))
, mainPanel(
rpivotTableOutput("test")
)
)),
server = function(input, output) {
output$test <- rpivotTable::renderRpivotTable({
rpivotTable(data = data)
})
output$config <- renderText({
tt <- installed.packages()
paste(paste(tt[tt[, 1] %in% c("shiny", "htmlwidgets", "rpivotTable", "devtools") , 1],
tt[tt[, 1] %in% c("shiny", "htmlwidgets", "rpivotTable", "devtools") , 3]), collapse = ", ")
})
output$path <- renderText({
ll <- .libPaths()
ll
})
output$version <- renderText({
ss <- sessionInfo()
ss[[1]]$version.string
})
}
)
does anybody already met this error?
best,
Hello, gents,
Excellent work here. I'm working with Shiny. This package has been a godsend, literally. Thank you.
One rough are, however, is related to aesthetics. Any chance for better control over table aesthetics, directly from within R? For example, maximum column sizes or a separable, absolute table for the filters? Also, options to move the legends around would be nice.
I am happy to work on this myself, but have only rudimentary java and css skills. I am, however, willing to put in the effort to learn. Ideally, this could rival--say--Tableau in terms of overall UX.
Anyone willing to help me get started int his direction?
I need a derived attribute, which is the ratio of the other two variables. I know PivotTable.js supports the derived attributers. How I can do this in the R package? Thank you very much!
Nice binding!
Question: Is it possible to use the variable drag-and-drop functionality without the tables/graphs etc.? R could then handle the plotting, summarizing, etc.
The index.html page on cran.r-project.org references version 0.1.5.20; however, the NEWS.pdf document (here and on cran) includes references to only Version 0.1.5.9. Where can we go to see a description of the latest changes in version 0.1.5.20?
First off, this is a great package. When I run this in Rstudio, I do not have the option of selecting "Bar Chart", "Area Chart", or "Line Chart". Is this expected?
Hi there,
I've noticed that the 'rendererName' doesn't work. There is no error thrown, it just always defaults to table no matter what renderer you select.
I am working on ubuntu 14.04 and after putting such code:
require(sqldf)
require(rpivotTable)
data(mtcars)
rpivotTable(mtcars)
My rstudio hangs
When using rpivotTable inside a flexdashboard with a long table, the dashboard could not display correctly. Only fixed viewpoint could be displayed. It would be nice if something like scrollbars appear.
In shiny application, rpivotTable works fine
My declaration for flexdashboard
---
title: "Test rpivotTable"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: scroll
horizontal_layout: scroll
---
See rstudio/DT#22 (last comment)
Hi I'm really impressed with your implementation of pivot tables. I just have a bit of cosmetic issue: I'm trying to get output for a low/medium/high factor variable to have tabular out put that prints in the right order instead of alphabetical: high/ low/ medium
I saw in nicolas.kruchten's example where he tries to sort the labels in the javascript he does some special sortAs variable and then specificies the attributes for the day and month ordering in an if
statements. How might I do this in your R package?
I'm not that up on javascript, so I don't know how I might embed this technique in my markdown file. Any advice would be much appreciated.
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart", "charteditor"]});
$(function () {
var dateFormat = $.pivotUtilities.derivers.dateFormat;
var sortAs = $.pivotUtilities.sortAs;
var tpl = $.pivotUtilities.aggregatorTemplates;
var renderers = $.pivotUtilities.renderers;
var gchart_renderers = $.pivotUtilities.gchart_renderers
$.get("montreal_2014.csv", function(montreal_2014) {
$("#output").pivotUI($.csv.toArrays(montreal_2014), {
aggregators: {
"Mean Temp (Celcius)":
function() { return tpl.average()(["Mean Temp (C)"])},
"Max Temp (Celcius)":
function() { return tpl.max()(["Max Temp (C)"]) },
"Min Temp (Celcius)":
function() { return tpl.min()(["Min Temp (C)"]) },
"Total Rain (mm)":
function() { return tpl.sum()(["Total Rain (mm)"]) },
"Total Snow (cm)":
function() { return tpl.sum()(["Total Snow (cm)"]) }
},
derivedAttributes: {
"year": dateFormat("Date", "%y", true),
"month": dateFormat("Date", "%m", true),
"day": dateFormat("Date", "%d", true),
"month name": dateFormat("Date", "%n", true),
"day name": dateFormat("Date", "%w", true)
},
sorters: function(attr) {
if(attr == "month name") {
return sortAs(["Jan","Feb","Mar","Apr", "May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]);
}
if(attr == "day name") {
return sortAs(["Mon","Tue","Wed", "Thu","Fri","Sat","Sun"]);
}
},
hiddenAttributes: ["Date","Max Temp (C)","Mean Temp (C)","Min Temp (C)" ,"Total Rain (mm)","Total Snow (cm)"],
renderers: $.extend(renderers, gchart_renderers),
rows: ["year", "month name"],
cols: ["day name"]
});
});
});
</script>
FYI I just released a new version (1.4.0) of PivotTable.js which includes more C3 support, like a proper Area Chart and (finally) a Scatter Chart. I've also got an example of it where you can select any of the 700+ datasets that ship with R :) http://nicolas.kruchten.com/pivottable/examples/rcsvs.html
Hi! Is there a way to remove the row and totals from the rpivotTableOutput()? My output has 3x8 categories, so the total cells show totals for each category, which I don't want.
Hi,
I have upgraded the package and I have found conflicts with shiny's dateRangeInput
(dateInput
has the same problem). It seems to be some javascript confilct.
library(shiny)
library(rpivotTable)
ui = shinyUI(fluidPage(
dateRangeInput('dateRange',
label = 'Rango de Fechas: yyyy-mm-dd',
start = as.Date("2015-01-01"), end = Sys.Date() -1
),
rpivotTableOutput('table' )
))
server = function(input, output){
output$table <- renderRpivotTable({
iris %>%
tbl_df %>%
filter( Sepal.Width > 3 ) %>%
rpivotTable
})
}
shinyApp(ui = ui, server = server)
Thanks for your help!
Hi,
First of all, thank you for this wonderful package! I have a quite peculiar problem.
I'm trying to use exclusions
parameter. When I add two columns from which I exclude certain values then everything works (you can see that names of columns are tilted):
If I use only one column then it doesn't:
Code:
rpivotTable(
Titanic,
rows = "Survived",
cols = c("Class","Sex"),
aggregatorName = "Sum as Fraction of Columns",
exclusions = list(
Survived = as.list("No")
,
Class = as.list("1st")
),
vals = "Freq",
rendererName = "Table Barchart"
)
My session info:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS
locale:
[1] LC_CTYPE=pl_PL.UTF-8 LC_NUMERIC=C LC_TIME=pl_PL.UTF-8
[4] LC_COLLATE=pl_PL.UTF-8 LC_MONETARY=pl_PL.UTF-8 LC_MESSAGES=pl_PL.UTF-8
[7] LC_PAPER=pl_PL.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=pl_PL.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rpivotTable_0.1.5.8
loaded via a namespace (and not attached):
[1] htmlwidgets_0.5.1 htmltools_0.2.6 tools_3.2.2 rstudioapi_0.3.1
[5] yaml_2.1.13 rstudio_0.98.1103 jsonlite_0.9.17 digest_0.6.8
Hello,
When the Number of types/values for a variable I get the error "too many to list" when trying to select. Please help on this.
-Mani
I notice that currently 2-digit decimal is set as default.
Is it possible that I could change this value?
Thank you in advance.
Hi,
It turns out that the rendererName
argument of rpivotTable
functions doesn't work :(
Here is a screen with example from documentation:
My session info:
> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS
locale:
[1] LC_CTYPE=pl_PL.UTF-8 LC_NUMERIC=C LC_TIME=pl_PL.UTF-8
[4] LC_COLLATE=pl_PL.UTF-8 LC_MONETARY=pl_PL.UTF-8 LC_MESSAGES=pl_PL.UTF-8
[7] LC_PAPER=pl_PL.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=pl_PL.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rpivotTable_0.1.5.7
loaded via a namespace (and not attached):
[1] htmlwidgets_0.5.1 htmltools_0.2.6 tools_3.2.1 rstudioapi_0.3.1 yaml_2.1.13
[6] rstudio_0.98.1103 jsonlite_0.9.17 digest_0.6.8
The width of line chart cannot be changed. Setting the width
parameter doesn't change anything.
Good morning,
I've tried following the rpivotTable example from an article I read on LinkedIn, but I'm getting this error when I call the rpivotTable function.
The code (as on LinkedIn) is:
library(devtools)
install_github("ramnathv/htmlwidgets")
install_github("smartinsightsfromdata/rpivotTable")
library(rpivotTable)
data(mtcars)
rpivotTable(mtcars, rows="gear", col="cyl", aggregatorName="Average",
vals="mpg", rendererName="Treemap")
Any suggestions on how to fix it as I'd like to see if this can help my team out with any of our current or upcoming client projects?
Are you planning to push rpivotTable to CRAN? I think everything works with the version of htmlwidgets on CRAN
Can you help please.
I can't install rpivotTable on a windows 7 pc (RStudio Version 0.99.447).
Here is the output I get:
Installing htmlwidgets
Installing 1 packages: yaml
package ‘yaml’ successfully unpacked and MD5 sums checked
"C:/Program Files/R/R-32~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore CMD
INSTALL
"C:/Users/PK/AppData/Local/Temp/RtmpCEscPS/devtoolse6834c7b67/ramnathv-htmlwidgets-955ddc0"
--library="C:/Users/PK/Documents/R/win-library/3.2" --install-tests
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Error: Command failed (1)
install_github("smartinsightsfromdata/rpivotTable")
Downloading github repo smartinsightsfromdata/rpivotTable@master
Installing rpivotTable
Installing 1 packages: htmlwidgets
package ‘htmlwidgets’ successfully unpacked and MD5 sums checked
"C:/Program Files/R/R-32~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore CMD
INSTALL
"C:/Users/PK/AppData/Local/Temp/RtmpCEscPS/devtoolse682da67e74/smartinsightsfromdata-rpivotTable-89fcddf"
--library="C:/Users/PK/Documents/R/win-library/3.2" --install-tests
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Error: Command failed (1)
Thanks in advance
PK
Does rpivotTable indeed still depend on the development version of the htmlwidgets package?
We are looking at upgrading our htmlwidgets package from 0.7 to 0.8.
Is there a way to save the results from analysis over the pivot table to a Data Frame? It would be very useful. Today the analysts create a lot of SQL queries or use Excel, with your Pivot Table they can use it and write it on a SQL Table or export to an Excel spreadsheet.
Hi,
I'm planning to use this package in Shiny, but I'm wondering if there's a way to "read" the user selected filter/row/column so that user can export the setting and reload it when they visit next time?
A minimal example is appreciated, thanks.
Just FYI there are some nice improvements in the latest version of PivotTable.js, especially around the filter menu... The API should be unchanged: https://github.com/nicolaskruchten/pivottable/releases
library(rpivotTable)
data(mtcars)
rpivotTable(mtcars)
Unable to load page
Problem occurred while loading the URL http://tmp/RtmpcvwPCH/viewhtml4a5376c24e63/index.html
Cannot resolve hostname (tmp)
I beleive it is browser dependent problem.
It should always work with path file:///tmp/RtmpcvwPCH/viewhtml4a5376c24e63/index.html
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_IE.UTF-8 LC_NUMERIC=C LC_TIME=en_IE.UTF-8 LC_COLLATE=en_IE.UTF-8 LC_MONETARY=en_IE.UTF-8 LC_MESSAGES=en_IE.UTF-8 LC_PAPER=en_IE.UTF-8 LC_NAME=en_IE.UTF-8
[9] LC_ADDRESS=en_IE.UTF-8 LC_TELEPHONE=en_IE.UTF-8 LC_MEASUREMENT=en_IE.UTF-8 LC_IDENTIFICATION=en_IE.UTF-8
Installation details
> devtools::install_github(c("ramnathv/htmlwidgets", "smartinsightsfromdata/rpivotTable"))
Downloading github repo ramnathv/htmlwidgets@master
Installing htmlwidgets
'/usr/lib/R/bin/R' --vanilla CMD INSTALL '/tmp/RtmpcvwPCH/devtools4a536b6c70b1/ramnathv-htmlwidgets-083f018' --library='/home/cracs/R/x86_64-pc-linux-gnu-library/3.1' --with-keep.source --install-tests
* installing *source* package ‘htmlwidgets’ ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (htmlwidgets)
Downloading github repo smartinsightsfromdata/rpivotTable@master
Installing rpivotTable
'/usr/lib/R/bin/R' --vanilla CMD INSTALL '/tmp/RtmpcvwPCH/devtools4a53783a6b90/smartinsightsfromdata-rpivotTable-fcc20de' --library='/home/cracs/R/x86_64-pc-linux-gnu-library/3.1' --with-keep.source --install-tests
* installing *source* package ‘rpivotTable’ ...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (rpivotTable)
[INFO] Updating the R environment index started...
[INFO] The R environment index was updated successfully.
I am trying to use shiny::radioButtons
to update/refresh a pivot table (i.e. change initial rows/columns/variables setting), but that doesn't seem to be working.
In the below shiny
app, when you change the input based on radioButtons it does not get reflected in the rpivotTable
output. It stays the same regardless.
Do you know if there's anything wrong in this code? or is it even possible to achieve such a functionality?
Code:
library(shiny)
library(magrittr)
library(rpivotTable)
# based on radio button selection selects the list with specific parameter types
pivot_switch_fn <- function(l_in, type) {
switch(type,
choice1 = l_in$l1,
choice2 = l_in$l2)
}
d_in = data.frame(grp_var1 = rep(letters[1:5], times = 6),
grp_var2 = rep(letters[6:8], times = 10),
grp_var3 = rep(letters[9:10], times = 15),
metric1 = sample.int(n = 100, size = 30),
metric2 = sample.int(n = 100, size = 30),
metric3 = sample.int(n = 100, size = 30))
l1 = list(l_rows = "grp_var1",
l_cols = "grp_var2",
l_val = "metric1",
l_aggregatorName = "Sum",
l_rendererName = "Table")
l2 = list(l_rows = "grp_var2",
l_cols = "grp_var1",
l_val = "metric2",
l_aggregatorName = "Count",
l_rendererName = "Table Barchart")
l_in = list(l1 = l1,
l2 = l2)
rb_levels = list(`Choice 1` = "choice1",
`Choice 2` = "choice2")
server = function(input, output) {
output$pivot_setting_rb = renderUI({
radioButtons(inputId = "pivot_setting", label = "Shortcuts",
choices = rb_levels)
})
output$test <- rpivotTable::renderRpivotTable({
print(input$pivot_setting)
ls = pivot_switch_fn(l_in, input$pivot_setting)
print(ls)
ls %$%
rpivotTable(data = d_in,
rows = l_rows,
cols = l_cols,
val = l_val,
aggregatorName = l_aggregatorName,
rendererName = l_rendererName)
})
}
ui = fluidPage(
uiOutput("pivot_setting_rb"), br(),br(),br(),
rpivotTableOutput("test")
)
shinyApp(ui = ui, server = server, options = list(height = '3000px', width = '100%'))
Hi,
Thanks for providing this great package. It works very well in Rstudio, however, when I want to use it in shiny, it gave me this error for chart:
An error occurred rendering the PivotTable results.
Pivot table was working but all the charts gave me the error. How can I fix it?
My code:
ui:
tabPanel("Daily Result",rpivotTableOutput("test"))
server:
output$test <- renderRpivotTable({
tt<-data.frame(c(1,2,3,4,1,2,3,4),c('a','b','c','d','c','d','a','b'))
colnames(tt)<-c('x','y')
re=rpivotTable(data=tt)
re
})
Hi, is there a way to add multiple summarised attributes? e.g. two mean attributes?
Got this error:
/home/expat/R/x86_64-pc-linux-gnu-library/3.2/rpivotTable/htmlwidgets/lib/jqueryui/images/animated-overlay.gif: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 67
it looks like the whole image folder is not there and pandoc somehow needs it
pandoc commandline (used knit HTML from rstudio)
/usr/bin/pandoc +RTS -K512m -RTS pivottable.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output pivottable.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --variable 'theme:bootstrap' --include-in-header /tmp/RtmpNYrrbC/rmarkdown-strb2e44afa1939.html --mathjax --variable 'mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --no-highlight --variable highlightjs=/usr/local/lib/R/site-library/rmarkdown/rmd/h/highlight
Hi, I am not very good with JavaScript. Could you please help me create CumSum functionality? Thank you!
When I create a pivottable with a lot of rows / columns, It is not possible to scroll. I tested this in rstudio and in shiny. Result is the same;
Trying out rpivotTable in a shiny app. For some reason it is send the output straight to the Rstudio viewer and not the webpage. It also blocks the other elements of the tabset. Any ideas? Code linked below
As of now, only data.frame
works. I'll work on adding conversion for data.table
and table
into the function.
Hi, great package, I have used it to great effect in a data explorer in our company. So good it was that I have started using it in a second project. Alongside the (multiple) file uploader package shinyFiles (find it on CRAN).
ShinyFiles uses htmlWidgets to pass information between the server and ui. Where one of the htmlWidgets javascript files calls the renderValue js function. Unfortunatly rpivotTable.js also has a function called renderValue() and this is where things go wrong. There appears to be cross talk which means that I can't upload multiple files and use rpivotTable in the same shiny app.
Given the number of dependencies, it might be easier to change rpivotTable than htmlWidgets, is this change possible?
Thanks again
(PS I have removed a coluple of company-speciic packages from the sessionInfo())
Example Script
library(shiny)
library(rpivotTable)
library(shinyFiles)
# Define server logic required to draw a histogram
server <- function(input, output, session){
#volumes <- getVolumes()
volumes <- c(`Local (C)`="C:",
`Data (M)`="M:")
shinyFileChoose(input = input,
id = 'file',
roots = volumes,
session = session)
output$filepaths <- renderPrint({parseFilePaths(volumes, input$file)})
output$bPivotTable <- renderRpivotTable({
rpivotTable(data = iris)
})
}
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
fluidRow(strong("Choose files to upload:")),
fluidRow(
shinyFilesButton(id = "file",
label = "Files",
title = "Upload Files",
multiple = TRUE)
)
),
mainPanel(
verbatimTextOutput('filepaths'),
rpivotTableOutput("bPivotTable")
)
)
)
print(shinyApp(ui = ui, server = server))
Session Info
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] splines stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringr_1.0.0 lme4_1.1-12 Matrix_1.2-6 ggplot2_2.1.0 reshape2_1.4.1
[8] readxl_0.1.1 RODBC_1.3-13 leaflet_1.0.1 lubridate_1.5.6 rpivotTable_0.1.5.20 shiny_0.13.2 shinyFiles_0.6.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 magrittr_1.5 MASS_7.3-45 munsell_0.4.3 lattice_0.20-33 colorspace_1.2-6 xtable_1.8-2 R6_2.1.2
[9] minqa_1.2.4 plyr_1.8.4 tools_3.3.0 grid_3.3.0 nlme_3.1-127 gtable_0.2.0 htmltools_0.3.5 yaml_2.1.13
[17] digest_0.6.9 RJSONIO_1.3-0 nloptr_1.0.4 htmlwidgets_0.6 mime_0.4 stringi_1.1.1 scales_0.4.0 jsonlite_0.9.21
[25] httpuv_1.3.3
I recently started using rPivotTable to produce some impressive charts and tables. I am using rPivotTable in a Shiny application. I was wondering if it is possible to export the output of the rPivotTable(Table, Bar chart, line chart etc) as image from the web browser. In RStudio(without Shiny), it can be done as the viewer has an option for Export->Save as Image. Is there any way to save the charts and tables.
I have also added this question in Stackoverflow.
http://stackoverflow.com/questions/37950488/export-rpivottable-output-as-image-in-shiny
Thanks.
This package is really awesome, like it very much! Recently i am using this package to display the data by using line chart and it is working fine in Shiny. But when i link this shiny page to another website (using php) and display in that website's iframe, the Y-axis getting crazy and the interval between the Y-axis value label is very huge causing the Y-axis very long compare to the plot in Shiny. It might not be the rpivotTable package problem, but i just want to see if you have any idea anything i can configure for the rpivotTable so it can display properly in iframe of another webpage.
This is my R code, as you can see i have setup the height and it can display properly in Shiny.
rpivotTableOutput("pivot", width="100%", height="900px")
Below is the code for the iframe, even i configured the iframe height to smaller size but it will not resize the pivot table. The Y-axis for the line charts grow very long compare to how it looks like in Shiny.
Appreciate if you can advise. Thanks and have a nice day!
How can I export the data from rpivotTable in excel?
I would like to provide some citation to the packages used in my app. Generating the citation for rpivottable only works partially (see message below).
Warning in citation(i): no date field in DESCRIPTION file of package
'rpivotTable'
See links below where I mention your package in the helpfiles.
http://mostly-harmless.github.io/radiant/about.html
http://mostly-harmless.github.io/radiant/base/pivot.html
Hi @smartinsightsfromdata I have this result when I use
rpivotTable(data = dt, rows = "Party", cols = "Province", vals = "votes", aggregatorName = "Sum")
I don't know if it's a new issue (this package is relatively new).
I have created an rpivottable and for some of the factors that I want to drag and drop to create tables and graphs, they contain more than 500 factors. Is there a way to eliminate the limit of each factor so that when I click on any option in the pivottable, it will show me a list of the options and from there I can filter out what I want? Currently, when I click on the factors that have too large of a list, it states, "too large to list". And when I try and create the graphs, it doesn't work because there are too many factors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.