Comments (9)
The code below saves a csv. It works but I didn't tested extensively: any feedback is appreciated.
Please note that the code itself is not particularly optimised.
library(shiny)
library(rpivotTable)
library(rvest)
x <- read.csv("./forest/srs3a.csv", stringsAsFactors = FALSE)
ui <- fluidPage(sidebarLayout( sidebarPanel(
selectizeInput('row','Row:', choices = c('County','Unit','NULL')),
actionButton("go","Go"),
actionButton("save","Save"),
selectizeInput('state','State:',choices = c('Alabama','Arkansas','Florida','Texas')),
actionButton("map","Map")),
mainPanel(tabsetPanel(type="tabs",
tabPanel("Table",rpivotTableOutput("table")),
tabPanel("Map") ))
))
server <- function(input, output, session)
{
session$onSessionEnded(stopApp)
myrows <- eventReactive(input$go,
{switch(input$row,
"County" = c("COUNTYCD"),
"Unit" = c("UNITCD"))
})
output$table <- renderRpivotTable({
rpivotTable(x,
rows=myrows(),col="CSC",
aggregatorName="Sum",
vals="acres",
rendererName="Table",
inclusions=list(STNAME=list(input$state)),
onRefresh = htmlwidgets::JS("function(config) {Shiny.onInputChange('myData',
document.getElementById('table').innerHTML);
}"))
})
summarydf <- eventReactive(input$myData,{
input$myData %>%
read_html %>%
html_table(fill = TRUE) %>%
.[[2]]
})
observeEvent( input$save, {
if(nrow(summarydf() )<1) return()
write.csv(summarydf(), file="./forest.csv")
})
}
shinyApp(ui = ui, server = server)
from rpivottable.
from rpivottable.
The easy answer is no, you need shiny
: its scaffolding offers the mean to access the web page and get the data displayed.
For example, while you can use rpivotTable
in jupyter
with the R kernel
, jupyter
does not offer at the moment the mechanism to get the data from rpivotTable
as we do in shiny
(of course it could be added in the future).
As an alternative, it would be interesting to try with shiny gadgets
and rstudio addins
.
from rpivottable.
@EnricowithR see example from @Avatoo to see if ti works for you
#68
Let me know if it doesn't work and I'll re-open
from rpivottable.
hi I want to create shiny aap which help me create pivot table and download results can you help me with example thanks in advance
from rpivottable.
The above code is very useful but only when the pivot is rendered as a table. Is it possible to export a csv when a barchart is selected? In other words, no matter how the data is rendered in rpivottable, the export will always be as though Table was the renderer.
from rpivottable.
from rpivottable.
Hi,
There is an excellent solution for JS pivottable:
https://github.com/nicolaskruchten/pivottable/wiki/Optional-Extra-Renderers#exporting-to-tsv-demo
how can we use the optional extra renderer 'Export to tsv' in rpivottable?
from rpivottable.
Is there solution for this yet similar to the JS pivottable?
from rpivottable.
Related Issues (20)
- Provide option to escape html HOT 3
- pivottable does not work with login/logout module HOT 7
- Using pivotTable from static html HOT 1
- factor levels order is not retained HOT 7
- aggregate name: identity HOT 7
- reduce area of metadata in output table HOT 3
- append style to rpivotTable css styles HOT 2
- Easier extendibility of rpivotTable() for custom S3 classes
- Support Excel Date Slice? HOT 1
- rpivotTable doesn't display anything HOT 1
- Question: Is there a way to sort table by values displayed in current column selection?
- My question is, How to colorize "Heatmap", creating a function with "ifelse ()"?????
- Plotting multiple rpivotTable with for loop in html r-markdown
- Compatibility with Bootstrap 4? HOT 1
- Top row missing (where remaining pivot variables sit)
- Drop down arrows problem with crosstalk v.1.1.1.
- rpivotTable is not working together with shinyjqui
- Drop down lists open in wrong position HOT 9
- Can't sort the Total column in the Pivot Table
- Sort rows in locale with characters not found in English
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rpivottable.