{shinipsum} is now on CRAN

I'm very happy to announce that {shinipsum} is now on CRAN!

{shinipsum} is a package that can help you build {shiny} prototypes faster by providing a series of functions that can generate random elements to populate your UI. If you are familiar with “lorem ipsum”, the fake text generator that is used in software design as a placeholder for text, the idea is the same: generating placeholders for Shiny outputs.

{shinipsum} can be installed from CRAN with:

install.packages("shinipsum")

You can install this package from GitHub with:

remotes::install_github("Thinkr-open/shinipsum")

In this package, a series of functions that generates random placeholders. For example, random_ggplot() generates random {ggplot2} elements:

library(shinipsum)
library(ggplot2)
random_ggplot() + 
  labs(title = "Random plot") 

random_ggplot() + 
  labs(title = "Random plot") 

Of course, the idea is to combine this with a Shiny interface, for example random_ggplot() will be used with a renderPlot() and plotOutput(). And as we want to prototype but still be close to what your final application will look like, these functions take arguments that can shape the output: for example, random_ggplot() has a type parameter that can help you select a specific geom.

library(shiny)
library(shinipsum)
library(DT)
ui <- fluidPage(
  h2("A Random DT"),
  DTOutput("data_table"),
  h2("A Random Plot"),
  plotOutput("plot"),
  h2("A Random Text"),
  tableOutput("text")
)

server <- function(input, output, session) {
  output$data_table <- DT::renderDT({
    random_DT(5, 5)
  })
  output$plot <- renderPlot({
    random_ggplot(type = "point")
  })
  output$text <- renderText({
    random_text(nwords = 50)
  })
}
shinyApp(ui, server)

Other {shinipsum} functions include:

  • tables:
random_table(nrow = 3, ncol = 10)
##   conc rate   state conc.1 rate.1 state.1 conc.2 rate.2 state.2 conc.3
## 1 0.02   76 treated   0.02     76 treated   0.02     76 treated   0.02
## 2 0.02   47 treated   0.02     47 treated   0.02     47 treated   0.02
## 3 0.06   97 treated   0.06     97 treated   0.06     97 treated   0.06
  • print outputs:
random_print(type = "model")
## 
## Call:
## lm(formula = Sepal.Length ~ Sepal.Width, data = datasets::iris)
## 
## Coefficients:
## (Intercept)  Sepal.Width  
##      6.5262      -0.2234

… and text, image, ggplotly, dygraph, and DT.

Learn more about {shinipsum}:

Edit this page

Avatar
Colin Fay
Data Scientist and R Hacker

Datascientist – R Hacker – twitter addict

Related