All Projects → feddelegrand7 → fabricerin

feddelegrand7 / fabricerin

Licence: Unknown, AGPL-3.0 licenses found Licenses found Unknown LICENSE AGPL-3.0 LICENSE.md
Create Easily Canvas in Shiny and RMarkdown Documents

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to fabricerin

bubblyr
☁️ ☁️ ☁️ Beautiful Bubbles in Shiny and RMarkdown Backgrounds
Stars: ✭ 16 (-69.23%)
Mutual labels:  shiny, rmarkdown, rmarkdown-document
Explore
R package that makes basic data exploration radically simple (interactive data exploration, reproducible data science)
Stars: ✭ 69 (+32.69%)
Mutual labels:  shiny, rmarkdown
workshops-setup cloud analytics machine
Tips and Tricks to setup a cloud machine for Analytics and Data Science with R, RStudio and Shiny Servers, Python and JupyterLab
Stars: ✭ 12 (-76.92%)
Mutual labels:  shiny, rmarkdown
flipdownr
📆📆📆 Implement a Countdown in RMarkdown Documents and Shiny Applications
Stars: ✭ 30 (-42.31%)
Mutual labels:  shiny, rmarkdown
signals-and-systems
Interactive visualizations for Dr. Richard Baraniuk's open-source "Signals and Systems" textbook. R / Shiny.
Stars: ✭ 31 (-40.38%)
Mutual labels:  shiny, rmarkdown
learning R
List of resources for learning R
Stars: ✭ 32 (-38.46%)
Mutual labels:  shiny, rmarkdown
Gfonts
🔤 Offline Google Fonts for rmarkdown and shiny
Stars: ✭ 85 (+63.46%)
Mutual labels:  shiny, rmarkdown
Shufflecards
✨ Create magical grid layouts in Shiny & Markdown
Stars: ✭ 76 (+46.15%)
Mutual labels:  shiny, rmarkdown
Bsplus
Shiny and R Markdown addons to Bootstrap 3
Stars: ✭ 120 (+130.77%)
Mutual labels:  shiny, rmarkdown
Bslib
Tools for theming shiny and rmarkdown from R via Bootstrap (3 or 4) Sass.
Stars: ✭ 197 (+278.85%)
Mutual labels:  shiny, rmarkdown
epoxy
Extra-strength glue engines for R Markdown and Quarto
Stars: ✭ 141 (+171.15%)
Mutual labels:  shiny, rmarkdown
customer-tracker
R data products: Reports, Presentations, Apps, and API's
Stars: ✭ 19 (-63.46%)
Mutual labels:  shiny, rmarkdown
reportfactory
Lightweight infrastructure to handle multiple rmarkdown reports
Stars: ✭ 68 (+30.77%)
Mutual labels:  rmarkdown, rmarkdown-document
flexpivot
Simple frequency table
Stars: ✭ 19 (-63.46%)
Mutual labels:  shiny, rmarkdown
weasydoc
Convert R Markdown to PDF Using Weasyprint (or Prince XML)
Stars: ✭ 40 (-23.08%)
Mutual labels:  rmarkdown, rmarkdown-document
Anicon
Animated icons for R markdown and Shiny apps
Stars: ✭ 109 (+109.62%)
Mutual labels:  shiny, rmarkdown
grillade
Grid sytem for shiny apps or rmarkdown and to create htmlwidgets matrix
Stars: ✭ 16 (-69.23%)
Mutual labels:  shiny, rmarkdown
vembedr
Functions to Embed Video in HTML
Stars: ✭ 56 (+7.69%)
Mutual labels:  shiny, rmarkdown
cascadess
A style pronoun for {htmltools} tags
Stars: ✭ 18 (-65.38%)
Mutual labels:  shiny
vueR
vue.js for R
Stars: ✭ 131 (+151.92%)
Mutual labels:  shiny

fabricerin

Travis build status CRAN_time_from_release CRAN_latest_release_date metacran downloads metacran downloads License: AGPL v3 R badge

The fabricerin (spelled fabrikerine) package allows you to create easily canvas elements within your Shiny app and RMarkdown documents. Thanks to Garrick Aden-Buie, you can also use it within your xaringan slides. You can use the canvas to render shapes, images and text. You can also create a canvas for drawing/taking notes purposes. Under the hoods, fabricerin relies on the fabricjs JavaScript library.

Installation

You can install fabricerin from CRAN with:

install.packages("fabricerin")

You can install the development version from GitHub with:

# install.packages("remotes")

remotes::install_github("feddelegrand7/fabricerin")

Examples:

First of all, I’d like to state that all the example provided apply the same way to Shiny and Rmd documents. fabricerin is not an R wrapper for the fabricjs library. The package doesn’t cover all the capabilities of the library. The fabricerin package relies only on some specified features that according to me will help Shiny/Rmd users. Of course, if you need some improvement, feel free to create a Pull Request.

fabric_drawing() Create a canvas for taking notes


fabric_drawing() is pretty useful when you want to teach something and write some notes at the same time, below I provide an example using the xaringan package. Inside a xaringan slide you can just (for example) run R code in the left and take notes in the right:

Important: When you change a color, make sure that the erase box is not checked.

fabric_drawing() can be used the same way in Shiny:

library(shiny)
library(fabricerin)


ui <- fluidPage(
  
  
  fabric_drawing(cid = "canvas123")

)

server <- function(input, output){}

shinyApp(ui, server)

fabric_shape() Render shape objects in canvas


Currently, fabricerin supports three types of shapes: Rectangle, Triangle, Circle and Polygon. The user can interact with the shape and modify its position, size and rotation. If you want to disable this interactivity, you can set selectable =FALSE

library(shiny)
library(fabricerin)


ui <- fluidPage(
  

  fabric_shape(cid = "canvaId", # canvas id
               cfill = "orange", # canvas color
               cwidth = 800, # the width of the canvas
               cheight = 600, # the height of the canvas
               shapeId = "shapeId", # shape id
               shape = "Rect", 
               fill = "red", # shape color
               width = 400, 
               height = 400, 
               left = 100, # the position of the shape from the left relative to the canvas
               top = 100, # the position of the shape from the top relative to the canvas
               strokecolor = "darkblue", 
               strokewidth = 5, 
               selectable = TRUE)
  
)

server <- function(input, output){}

shinyApp(ui, server)

You can add as many shape as you want to an existing canvas using the fabric_shape_add() function. Don’t forget to reference the preexisting canvas with its ID:

library(shiny)
library(fabricerin)


ui <- fluidPage(
  
  
  fabric_shape(cid = "canvaId", 
               shapeId = "cr1", 
               shape = "Circle", 
               radius = 30, 
               left = 100), 
  
  fabric_shape_add(cid = "canvaId", 
                   shapeId = "cr2", 
                   shape = "Circle", 
                   radius = 30, 
                   left = 200),
  
  fabric_shape_add(cid = "canvaId", 
                   shapeId = "cr3", 
                   shape = "Circle", 
                   radius = 30, 
                   left = 300),
  
  fabric_shape_add(cid = "canvaId", 
                   shapeId = "cr4", 
                   shape = "Circle", 
                   radius = 30, 
                   left = 400)
  
)

server <- function(input, output){}

shinyApp(ui, server)

fabric_image() Render images in canvas


You can insert an image within a canvas a play with it using the fabric_image() function. Note that this function accepts only URL external images.

ui <- fluidPage(

fabric_image(cid = "cimage",
              cfill = "lightblue",
              imgId = "Rimg",
              imgsrc = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/R_logo.svg/724px-R_logo.svg.png")

              )

server <- function(input, output) {}


shinyApp(ui = ui, server = server)

Similar to shapes, you can add images to preexisting canvas using the fabric_image_add() function:

library(shiny)
library(fabricerin)

ui <- fluidPage(

 fabric_image(cid = "cimage",
              imgId = "Rimg",
              imgsrc = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/R_logo.svg/724px-R_logo.svg.png",
              imgheight = 200,
              imgwidth = 200),
 fabric_image_add(cid = "cimage",
                  imgId = "rstudioimg",
                  imgsrc = "https://raw.githubusercontent.com/rstudio/hex-stickers/master/PNG/dplyr.png",
                  imgwidth = 200,
                  imgheight = 200,
                  left = 400)
                  )

server <- function(input, output) {}

shinyApp(ui = ui, server = server)

fabric_text() Render text elements in canvas


The fabric_text() function has many arguments, feel free to check them out:

ui <- fluidPage(

fabric_text(cid = "cId",
          textId = "text",
          text = " 'But A Hero Is A Guy Who Gives Out The Meat To Everyone Else. \\n I Want To Eat The Damn Meat!' \\n Monkey D. Luffy",
          cfill = "#DD5347",
          left = 120,
          shadowCol = "blue",
          fontSize = 20,
          fontWeight = "bold",
          lineHeight = 3
          )
)
server <- function(input, output) {}

shinyApp(ui = ui, server = server)

Here also, we can use the fabric_text_add() function to incorporate a text object within a canvas element:

library(shiny)
library(fabricerin)


ui <- fluidPage(

fabric_shape(cid = "canvas123",
              cfill = "lightblue",
              cwidth = 1000,
              shapeId = "tri1",
              shape = "Triangle",
              fill = "darkblue"),

fabric_text_add(cid = "canvas123",
                 textId = "txt1",
                 text = "This is a darkblue Triangle !",
                 left = 350
                 )

                 )

server <- function(input, output) {}

shinyApp(ui = ui, server = server)

fabric_curtail() Add a background or an overlay image to a canvas

You can set an image as a background or as a foreground (overlay) for a canvas as follows:

Note that due to security reasons, you won’t be able to replicate the following example on some images’ sources.

ui <- fluidPage(

 fabric_shape(cid = "canvas123",
              shapeId = "tri1",
              shape = "Triangle",
              fill = "lightblue"),

fabric_curtail(cid = "canvas123",
              imgsrc = "https://st.depositphotos.com/1642482/1904/i/950/depositphotos_19049237-stock-photo-leaf.jpg",
              type = "background"

              )

)

server <- function(input, output) {}


shinyApp(ui = ui, server = server)

Code of Conduct

Please note that the fabricerin project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].