What is R Shiny?

R Shiny is a package for building interactive web apps with R. 

The distinguishing feature of R Shiny is that you can build analytical apps with minimum lines of code and simple syntax, and put them on the web in a short time.

Pivot for R Shiny

Great news for the data science and analytics community!

Now you can use our pivot table component in R Shiny projects.

We are extremely grateful to our active community for contributions. Thankfully to Mohamed El Fodil Ihaddaden, now our users can perform data analysis with WebDataRocks in R Shiny apps. 

R Shiny comes with a great collection of interactive widgets. We believe WebDataRocks perfectly complements it. With the pivot table and simple syntax of R, you can build a dashboard that assists in connecting data scientists with decision-makers.

Features & benefits of Pivot for R

The role of WebDataRocks lies in aggregating and presenting your data in a neat tabular report. By handling all the data-related calculations, it acts as an engine for your dashboard. So, once it’s added to the dashboard, end-users can:

  • Drag and drop fields on the grid
  • Slice and dice data to compose a unique report
  • Sort and filter data records
  • Highlight values with conditional formatting
  • Format numbers on the grid
  • Export reports into a suitable format

And more! To dive into the world of WebDataRocks features, peek into our UI guide.

Creating a simple analytical app with R Shiny

Let’s apply our knowledge in practice and create a single-file R Shiny app with basic reporting functionality.

Create a new directory (e.g., reporting_app) and the app.R file that contains a user-interface definition and a server script. Run the R Studio and make this folder your working directory.

Next, install the pivtalibrary – a wrapper for R:

remotes::install_github("feddelegrand7/pivta")

Then, load the package to the app:

library(pivta)

Next, render the pivot table using pivta() function and passing the path to a data source and the report configuration as inputs.

pivta(dsource = "https://cdn.webdatarocks.com/data/data.csv", report = "https://cdn.webdatarocks.com/reports/report.json")

Here is how the full code of the app looks like:

library(shiny)
library(pivta)

ui <- fluidPage(
  
  # App title ----
  titlePanel("Reporting app"),
  pivtaOutput(outputId = "pivot_table")
)

server <- function(input, output) {
  
  output$pivot_table <- renderPivta({
    pivta(dsource = "https://cdn.webdatarocks.com/data/data.csv", report = "https://cdn.webdatarocks.com/reports/report.json")
  })
}

shinyApp(ui = ui, server = server)

Despite being simple, it creates an app with powerful pivoting features. 

Results

Now you have an interactive dashboard in your R Shiny app. You can extend the app's look and feel by tailoring the UI, add more interactive elements and graphs to your dashboard, or even implement more complex server-side logic. 

Be open to experiments. Make your analysis more interactive, comprehensive, and powerful with WebDataRocks for R. 

Code 

Find the R wrapper for WebDataRocks Pivot Table on GitHub