Package 'freewall'

Title: A Wrapper of the JavaScript Library 'Freewall'
Description: Creates dynamic grid layouts of images that can be included in 'Shiny' applications and R markdown documents.
Authors: Stéphane Laurent [aut, cre], Minh Nguyen [cph] (author of the JavaScript library 'Freewall')
Maintainer: Stéphane Laurent <[email protected]>
License: GPL-3
Version: 1.0.0
Built: 2024-10-28 03:19:00 UTC
Source: https://github.com/stla/freewall

Help Index


Some images

Description

Twenty-four urls pointing to an image.

Usage

alphabet()

Value

A character vector of 24 urls pointing to an image.

Examples

freewall(alphabet(), widths = 200, cellW = 200, cellH = "auto")

The 'freewall' widget

Description

Creates a grid of images.

Usage

freewall(
  images,
  backgroundImages = FALSE,
  widths = 100,
  heights = NULL,
  width = "100%",
  draggable = FALSE,
  animate = TRUE,
  cellW = 100,
  cellH = 100,
  delay = 0,
  fixSize = NULL,
  gutterX = 10,
  gutterY = 10,
  keepOrder = TRUE,
  rightToLeft = FALSE,
  bottomToTop = FALSE,
  elementId = NULL
)

Arguments

images

character vector of paths or urls to some images; for a Shiny app, the image files must be located in the www subfolder

backgroundImages

Boolean, whether to render the images with the CSS property background-image or with img elements

widths

the widths of the images in pixels; if a single value is given, it will be used for all images

heights

the heights of the images in pixels; if a single value is given, it will be used for all images; setting the heights is necessary if backgroundImages=TRUE, otherwise this argument can be set to NULL

width

the width of the container

draggable

Boolean, whether to enable draggability

animate

Boolean, whether to animate

cellW

width of unit, a number of pixels or "auto"

cellH

height of unit, a number of pixels or "auto"

delay

time delay for showing an item

fixSize

see freewall options

gutterX

space between columns, a number of pixels or "auto"

gutterY

space between rows, a number of pixels or "auto"

keepOrder

Boolean, whether to keep the order of the images

rightToLeft

Boolean, whether to let the layout start render from right to left

bottomToTop

Boolean, whether to let the layout start render from bottom to top

elementId

a HTML id for the container (usually useless)

Value

A htmlwidget object.

Examples

freewall(
  nature(), widths = 200, cellW = 200, cellH = 200, draggable = TRUE
)

Shiny bindings for 'freewall'

Description

Output and render functions for using freewall within Shiny applications and interactive Rmd documents.

Usage

freewallOutput(outputId, width = "100%", height = "auto")

renderFreewall(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

output variable to read from

width, height

a valid CSS dimension (like "100%", "400px", "auto") or a number, which will be coerced to a string and have "px" appended

expr

an expression that generates a freewall

env

the environment in which to evaluate expr

quoted

logical, whether expr is a quoted expression (with quote()); this is useful if you want to save an expression in a variable

Value

freewallOutput returns an output element that can be included in a Shiny UI definition, and renderFreewall returns a shiny.render.function object that can be included in a Shiny server definition.

Examples

if(require(shiny) && interactive()) {
library(shiny)
library(freewall)

ui <- fluidPage(
  freewallOutput("fw")
)

server <- function(input, output, session) {
  output$fw <- renderFreewall({
    freewall(alphabet(), widths = 200, cellW = 200, cellH = "auto")
  })
}

shinyApp(ui, server)
}

Some images

Description

Nine urls pointing to an image.

Usage

nature()

Value

A character vector of nine urls pointing to an image.

Examples

freewall(
  nature(), widths = 200, cellW = 200, cellH = "200", draggable = TRUE
)