Package 'shinipsum'

Title: Lorem-Ipsum-Like Helpers for Fast Shiny Prototyping
Description: Prototype your shiny apps quickly with these Lorem-Ipsum-like Helpers.
Authors: Colin Fay [cre, aut] (ORCID: <https://orcid.org/0000-0001-7343-1846>), Sebastien Rochette [aut] (ORCID: <https://orcid.org/0000-0002-1565-9313>), ThinkR [cph, fnd]
Maintainer: Colin Fay <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2026-09-17 07:57:12 UTC
Source: https://github.com/ThinkR-open/shinipsum

Help Index


Get a shinipsum example

Description

Get a shinipsum example

Usage

ipsum_examples(which = NULL)

Arguments

which

The example to run. If empty, all the available examples are listed.

Value

A path to the example.

Examples

ipsum_examples()

Lorem text

Description

A long lorem ipsum text

Usage

lorem

Format

An object of class character of length 1.


Lorem test as vector

Description

A long vector of words

Usage

lorem_words

Format

An object of class character of length 13657.


A Random DT

Description

This function creates a random DT::datatable, and can be passed into renderDT & DTOutput.

Usage

random_DT(
  nrow,
  ncol,
  type = c("random", "numeric", "character", "numchar"),
  ...
)

Arguments

nrow

number of row of the output

ncol

number of cols of the output

type

type of the columns, can be "random", "numeric", "character", "numchar". Default is random.

...

arguments to be passed to DT::datatable

Value

a DT


A Random Dygraph

Description

This function returns a dygraph object, which can be passed to renderDygraph and dygraphOutput

Usage

random_dygraph(...)

Arguments

...

args passed to dygraph

Value

a dygraph


A Random ggplot

Description

This function returns a ggplot object, which can be passed to renderPlot and plotOutput

Usage

random_ggplot(
  type = c("random", "point", "bar", "boxplot", "col", "tile", "line", "bin2d",
    "contour", "density", "density_2d", "dotplot", "hex", "freqpoly", "histogram",
    "ribbon", "raster", "violin", "ts"),
  n_bars = NULL
)

Arguments

type

type of the geom. Can be any of "random", "point", "bar", "boxplot","col", "tile", "line", "bin2d", "contour", "density", "density_2d", "dotplot", "hex", "freqpoly", "histogram", "ribbon", "raster", "violin", "ts" (alias "timeseries") and defines the geom of the ggplot. Default is "random", and chooses a random geom for you. The "ts" type returns a time-series oriented plot, with a Date on the x axis.

n_bars

number of bars to draw. Only valid together with type = "bar", and errors otherwise. When NULL (default) one of the built-in datasets is used instead.

Value

a ggplot


A Random ggplotly

Description

This function returns a ggplotly object, which can be passed to renderPlotly and plotlyOutput

Usage

random_ggplotly(...)

Arguments

...

arg to pass to random_ggplot.

Value

a ggplotly


A Random Image

Description

This function returns a random image that can be passed into renderImage and plotOutput.

Usage

random_image(width = NULL, height = NULL, alt = NULL)

Arguments

width

image width passed through to the rendered ⁠<img>⁠ tag. NULL (default) leaves the attribute unset (#9).

height

image height, same semantics as width (#9).

alt

alt attribute for accessibility. NULL (default) leaves the attribute unset (#9).

Value

a list compatible with shiny::renderImage(): src, plus the width / height / alt attributes when provided.


A Random External Image from the Lorem Picsum API

Description

Returns an ⁠<img>⁠ tag pointing at a random image served by the Lorem Picsum API, ready to be dropped inside a Shiny UI for quick prototyping. No network request is performed by this function: only the URL is built, the image is fetched by the browser.

Usage

random_image_ext(width = 400, height = 400, seed = NULL)

Arguments

width, height

image dimensions, in pixels. Single positive (finite, whole) numbers.

seed

optional seed making the picked image stable across calls. Any atomic scalar; it is coerced to a string and URL-encoded. When NULL (default), a fresh random image is served on every request.

Value

an ⁠<img>⁠ htmltools::tag

Examples

random_image_ext()
random_image_ext(width = 400, height = 600, seed = "caramba")

A Random Linear Model

Description

This function returns a model which can be passed to renderText or renderTable if pre-processed appropriately

Usage

random_lm(nobs = 100, nx = 2)

Arguments

nobs

Numeric. number of observation

nx

Numeric. number of variables. Should be lower that nobs

Value

a model output


A Mock UI Layout

Description

Build a quick "zoning" of a Shiny UI: a row of bootstrap columns, each one drawn as an empty bordered box with a centered label. Handy to sketch the layout of an app before any real content exists.

Usage

random_mock(widths, heights = 3, labels = NULL)

Arguments

widths

integer vector of bootstrap column widths (each between 1 and 12). Its length defines the number of mock zones.

heights

integer vector giving the visual height of each zone, expressed as a number of blank lines. Recycled to the length of widths. Default 3.

labels

character vector of zone labels. Recycled to the length of widths. When NULL (default), short random lorem-ipsum labels are used.

Details

The returned object is a htmltools::tagList() (a self-contained CSS ⁠<style>⁠ block plus the columns), so it can be dropped directly inside a shiny::fluidPage() / bslib::page_fluid() and rendered as is.

Value

a htmltools::tagList()

Examples

random_mock(c(4, 8))
random_mock(c(6, 6), labels = c("a plot here", "a table here"))

A Random print output

Description

This function returns a random print output that can be passed to renderPrint and verbatimTextOutput.

Usage

random_print(type = c("character", "numeric", "integer", "model", "table"))

Arguments

type

type of the output ("character", "numeric", "model", "table")

Value

a random print


A Random Table

Description

This function returns a table that can be passed to renderTable and tableOutput.

Usage

random_table(nrow, ncol, type = c("random", "numeric", "character", "numchar"))

Arguments

nrow

number of row of the output

ncol

number of cols of the output

type

type of the columns, can be "random", "numeric", "character", "numchar". Default is random.

Value

a table


A Random Lorem Ipsum

Description

A Random Lorem Ipsum

Usage

random_text(nchars = NULL, nwords = NULL, offset = 0, var = 1)

Arguments

nchars

number of characters. One of the two params should be left NULL.

nwords

number of words to return. One of the two params should be left NULL.

offset

number of characters or words to offset the result by. Defaults to 0.

var

integer >= 1 selecting a "variant" of the text: each value returns a distinct slice of the lorem-ipsum corpus, so repeated calls (e.g. in a bulleted list) don't all look alike. Defaults to 1. The corpus wraps around when var is large.

Value

a text