A quick and easy way to convert an R data.frame to a Tableau .tde or .hyper Extract.
Prerequisites
and Installing
section of pandleau to install TableauSDK(or Extract API 2.0, depends on whether you want to output as .tde or .hyper format) and pandleau itself.Once installing prerequisites is done, install the package from this repository:
install.packages("devtools")
devtools::install_github("zhiruiwang/RTableau")
The most simple example is output iris dataset into .tde or .hyper format:
library(RTableau)
write_tableau(iris,"iris.tde")
Another example that involves setting spatial column and add index: I grabbed the following Brazil flights data off of kaggle for this example: https://www.kaggle.com/microtang/exploring-brazil-flights-data/data.
library(tidyverse)
library(RTableau)
# Read in the data and select first 1000 rows
example_df <- read_csv("BrFlights2.csv")
example_df <- slice(example_df,1:1000)
# Set up a spatial column as `POINT (Lon Lat)` format
example_df <- example_df %>%
mutate(SpatialDest = paste0("POINT (",round(LongDest,6)," ",round(LatDest,6),")"))
# Write .tde or .hyper Extract!
write_tableau(example_df,"BrFlights.tde","SpatialDest",add_index = T)
This project is licensed under the MIT License - see the LICENSE.md file for details
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.