/
deployment.Rmd
46 lines (35 loc) · 1.36 KB
/
deployment.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: "Deployment to Shiny Server and shinyapps.io"
output:
github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Deploying a **corporaexplorer** app with your own data (corporaexplorerobject) to a
*[Shiny Server](https://rstudio.com/products/shiny/shiny-server/)* or
*[shinyapps.io](https://www.shinyapps.io/)*
is very simple -- all it takes is a folder with two files and three lines of code.
Example folder structure of the folder "my_app":
```
my_app
|
|-- app.R
|-- saved_corporaexplorerobject.rds
```
Where "app.R" contains this code:
```{r eval=FALSE, include=TRUE}
library(corporaexplorer)
corpus <- readRDS("saved_corporaexplorerobject.rds")
explore(corpus)
```
The folder "my_app" is now ready to be hosted on a *Shiny Server* or be uploaded to *shinyapps.io*.
<hr>
*Tip 1: use the settings in the* `plot_options` *argument in* `explore()` *to fine-tune the appearance of the plots in the app.*
*Tip 2: to make the data load faster (at the cost of occupying more disk space), save the corporaexplorerobject created by* `prepare_data()` *uncompressed by setting* `compress = FALSE` *in* `saveRDS()`.
*Example (assuming you start with a data frame called df):*
```{r eval=FALSE, include=TRUE}
library(corporaexplorer)
corpus <- prepare_data(df)
saveRDS(corpus, "saved_corporaexplorerobject.rds", compress = FALSE)
```