Skip to content

Commit 5fe30dc

Browse files
authored
Add plumbertableau-example (#81)
* Add plumbertableau-example * Add additional R exclusions to .gitignore * Add filter to worfklow * Update manifest with all dependencies * Allow and include renv * Remove errant renv outside of extension folder * Fix content name
1 parent 40cd732 commit 5fe30dc

File tree

11 files changed

+5272
-2
lines changed

11 files changed

+5272
-2
lines changed

.github/workflows/extensions.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
landing-page: extensions/landing-page/**
4040
stock-api-fastapi: extensions/stock-api-fastapi/**
4141
connectwidgets-example: extensions/connectwidgets-example/**
42+
plumbertableau-example: extensions/plumbertableau-example/**
4243
fastapitableau-example: extensions/fastapitableau-example/**
4344
4445
# Runs for each extension that has changed from `simple-extension-changes`

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# RStudio
22
.Rproj.user
3-
**/renv/
4-
.Rprofile
3+
.RData
4+
.Rhistory
55

66
# Quarto
77
.quarto/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source("renv/activate.R")
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Tableau R Extension
2+
3+
## About this example
4+
5+
plumbertableau is an R package that enables R developers to build Plumber APIs that function as Tableau Analytics Extensions. These extensions can be leveraged from Tableau workbooks to allow real time requests from Tableau to R. This extension builds on top of Tableau's example Superstore dataset.
6+
7+
8+
## Learn more
9+
10+
* [Learn how to use this extension from Tableau](https://github.com/sol-eng/tableau-examples/tree/main/superstore)
11+
* [Documentation for plumbertableau](https://rstudio.github.io/plumbertableau/)
12+
* [Configuring Posit Connect for use with Tableau](https://docs.posit.co/rsc/integration/tableau/)
13+
14+
## Requirements
15+
16+
* Posit Connect license allows API publishing
17+
* R version 3.2 or higher
18+
19+
<!-- NOTE: this file is generated -->

extensions/plumbertableau-example/manifest.json

Lines changed: 1774 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
library(plumber)
2+
library(plumbertableau)
3+
library(outForest)
4+
library(dplyr)
5+
6+
#* @apiTitle Outlier Detection for Tableau
7+
#* @apiDescription Detect outliers in real-time on Tableau data using a Random Forest
8+
9+
#* Calculate outliers on input data
10+
#* @tableauArg sales:numeric Numeric values representing sales for a given transaction
11+
#* @tableauArg profit:numeric Numeric values representing profit for a given transaction
12+
#* @tableauReturn logical A vector indicating the outlier status of each original observation
13+
#* @post /detect-outliers
14+
function(sales, profit) {
15+
dat <- tibble(sales, profit)
16+
out <- outForest(dat)
17+
outlier_rows <- outliers(out) %>%
18+
select(row) %>%
19+
distinct()
20+
21+
dat %>%
22+
mutate(row = 1:n(),
23+
outlier = row %in% outlier_rows$row) %>%
24+
pull(outlier)
25+
}
26+
27+
#* @plumber
28+
tableau_extension
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Version: 1.0
2+
3+
RestoreWorkspace: Default
4+
SaveWorkspace: Default
5+
AlwaysSaveHistory: Default
6+
7+
EnableCodeIndexing: Yes
8+
UseSpacesForTab: Yes
9+
NumSpacesForTab: 2
10+
Encoding: UTF-8
11+
12+
RnwWeave: Sweave
13+
LaTeX: pdfLaTeX
14+
15+
AutoAppendNewline: Yes
16+
StripTrailingWhitespace: Yes

extensions/plumbertableau-example/renv.lock

Lines changed: 2071 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
library/
2+
local/
3+
cellar/
4+
lock/
5+
python/
6+
sandbox/
7+
staging/

0 commit comments

Comments
 (0)