MyNixOS website logo
Description

Turn 'Plumber' APIs into 'Tableau' Extensions.

Build 'Plumber' APIs that can be used in 'Tableau' workbooks. Annotations in R comments allow APIs to conform to the 'Tableau Analytics Extension' specification, so that R code can be used to power 'Tableau' workbooks.

plumbertableau

R-CMD-check Codecov testcoverage CRANstatus

plumbertableau lets you call external R code in real time from Tableau workbooks via Tableau Analytics Extensions. You achieve this by writing a plumbertableau extension, which is a Plumber API with some extra annotations — comments prefixed with #*.

library(plumber)
library(plumbertableau)

#* @apiTitle String utilities
#* @apiDescription Simple functions for mutating strings

#* Capitalize incoming text
#* @tableauArg str_value:[character] Strings to be capitalized
#* @tableauReturn [character] A capitalized string(s)
#* @post /capitalize
function(str_value) {
  toupper(str_value)
}

# The Plumber router modifier tableau_extension is required. This object is a
# function that acts as a plumber router modifier. For more details, see the
# Plumber documentation:
# https://www.rplumber.io/articles/annotations.html#plumber-router-modifier
#* @plumber
tableau_extension

plumbertableau extensions are used in Tableau’s calculated fields. Let’s imagine we’ve published our extension to RStudio Connect and have given it the custom URL stringutils. To use our capitalize extension, we’d type the following into a Tableau calculated field, or just copy and paste it from the automatically generated code samples. (In real usage, you’ll probably replace "Hello World" with references to Tableau data.)

SCRIPT_STR("/stringutils/capitalize", "Hello World")

Before you use the extension in Tableau, Tableau needs to be able to access it. plumbertableau integrates seamlessly with RStudio Connect, a commercial publishing platform that enables R developers to easily publish a variety of R content types. Connect lets you host multiple extensions by ensuring that requests from Tableau are passed to the correct extension. It’s also possible to host plumbertableau extensions on your own servers.

Installation

You can install plumbertableau from CRAN or install the latest development version from GitHub.

# From CRAN
install.packages("plumbertableau")

# From GitHub
remotes::install_github("rstudio/plumbertableau")

library(plumbertableau)

FAQ

I thought Tableau already supports R?

Tableau’s current support for R as an analytics extension is built on Rserve. This approach requires configuring Rserve in a separate environment and then passing R code as plain text from Tableau calculated fields to be executed by Rserve.

Why would I use this instead of RServe?

The approach suggested here allows specific endpoints to be called, rather than requiring the Tableau user to write and submit R code in a plain text field from Tableau. This allows Tableau users to be seperate from the extension developers. R developers can build extensions that are then used by Tableau developers who may have no working knowledge of R.

Is RStudio Connect required?

While this package has been designed specifically with RStudio Connect in mind, it will work independent of RStudio Connect.

What are the advantages of RStudio Connect?

RStudio Connect offers a number of advantages as a deployment platform for Tableau Analytics Extensions:

  • Tableau workbooks can only be configured to use a single extension endpoint, which typically limits a workbook to only using one type of extension. RStudio Connect can host both R and Python based extensions, which means that a single Tableau workbook can use both R and Python based extensions hosted on RStudio Connect.
  • R developers can develop extensions in their preferred development environment and then publish to RStudio Connect
  • Extensions published to RStudio Connect can be secured to only allow access from specific accounts
  • RStudio Connect natively handles R and Python packages, which allows extensions to seemlessly use different versions of underlying packages without creating conflicts.
  • RStudio Connect processes are sandboxed, which limits the scope of impact the extension can have on the underlying OS.

Why can’t I just write my own Plumber API to function as an analytics extension?

Tableau Analytics Extensions are configured to reach out to two specific endpoints:

  • /info: Information about the extension
  • /evaluate: Execution endpoint for the extension

plumbertableau automatically generates the /info endpoint and reroutes requests to /evaluate to the endpoint defined in the script value of the request body. This allows multiple endpoints to function as extensions, rather than relying on a single extension operating under /evaluate. These features are intended to allow the R developer to easily create Tableau Analytics Extensions as standard Plumber APIs without needing to worry about the lower level implementation.

Further Reading

You can read more about plumbertableau at https://rstudio.github.io/plumbertableau/. There, you’ll find more detail about writing plumbertableau extensions, publishing them to RStudio Connect, configuring Tableau, and using your extensions in Tableau.

Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows