Giter Club home page Giter Club logo

r2resize's Introduction

r2resize: In-text resizing of containers, images and tables in Rmarkdown documents and Shiny apps

Demo output: View here

Demo complete YouTube tutorial: View here

Demo short video: View here

Sample R code to get started: View here

Other packages required for r2resize: View here

RPKG.net package page for r2resize: View here

CRAN_Status_Badge CRAN_Status_Badge

The recommendation is that you download the latest version of this package from CRAN, as I am constantly updating this repository. If you do download from here, know that things may break sometimes

Installation

# From CRAN
install.packages(r2resize)

# OR from Github
library(devtools)
install_github("oobianom/r2resize")

# Load library and begin using functions
library(r2resize)

# JQuery is required for most of the functions to run effectively
add.JQuery() #optional: only add if the page does not automatically include JQuery

Screenshots:

Use in Rmarkdown or Quarto document to add resizing toolbar to images and tables on the page

Code:



r2resize::add.resizer(
  theme.color = "black",
  position = "top",
  font.size = "12px",
  font.color = "black",
  tables = TRUE,
  images = TRUE,
  line.color = "orange",
  line.height = 5,
  line.width = 200,
  default.image.width = "40%"
)

Use in Shiny, Rmarkdown or Quarto document

As of version 1.6, the flexCard() function

Output:

Code:

flexCard(
  image = c(bg = "image1.jpg", icon = "edit", title="Sample text 1",subtitle="A cool subtitle"),
  image = c(bg = "image2.jpg", icon = "fire", title="Another sample text",subtitle="Focused subt title"),
  image = c(bg = "image3.jpg", icon = "wifi", title="Sample text 2",subtitle="Color text",text.color="brown"),
  image = c(bg = "image4.jpg", icon = "user", title="Sample text 3",subtitle="Color text and icon",icon.color="blue",text.color="purple"),
  image = c(bg = "image5.jpg", icon = "folder", title="Sample text 3",subtitle="Sub it is"),
  image = c(bg = "image6.jpg", icon = "key", title="Sample text 4",subtitle="Sub it is"),
  image = c(bg = "image7.jpg", icon = "lock", title="Smaple",subtitle="Sub it is",text.color="green"),
  image = c(bg = "image8.jpg", icon = "plus",icon.color="red"),
  border.color = "gray",
  border.width.px = 0,
  active.panel = 2
)

Also, the elastiCard() function

Output:

Code:

elastiCard(
  image = c(bg = "image1.jpg", title="Sample text 3",subtitle="Sub it is",descr="Sample description"),
  image = c(bg = "image2.jpg", icon = "key", title="Sample text 4",subtitle="Sub it is"),
  image = c(bg = "image3.jpg", icon = "lock", title="Smaple",subtitle="Sub it is",text.color="brown"),
  image = c(bg = "image4.jpg"),
  border.color = "black",
  border.width.px = 5
)

Also, the splitCard2() function

Output:

Code:

splitCard2(
  "question text 1",
  "answer text 2",
  bg.right.color = "black",
  bg.left.color = "red",
  text.left.color = "white",
  text.right.color = "white",
  slider.position = "95"
)

And so many more cool features...

windowCard()

emphasisCard()

sizeableCard()

splitCard()

NOTE: Please note that r2resize::add.resizer() should only be used in Rmarkdown or Quarto

By Obinna Obi Obianom, Creator of www.rpkg.net and www.shinyappstore.com

r2resize's People

Contributors

oobianom avatar

Stargazers

Patrick Howard avatar Francisco Rodriguez-Sanchez avatar Indrajeet Patil avatar Aurélien Ginolhac avatar Shinya Uryu avatar  avatar Allan Irvine avatar Wandrys Nascimento avatar  avatar ancbiosoc avatar  avatar Eli Pousson avatar  avatar  avatar

Watchers

 avatar

Forkers

wandrys-dev

r2resize's Issues

Images do not always get a resize bar

Hi there,

I can only get the resize bar to appear with images when I also have a table in the code. The example below demonstrates what I am saying.

I am using R 4.3.2, RStudio 2023.12.1 (402), Quarto 1.4.533, Windows 11

thanks,
Charlie

---
title: "test r2resize"
format: html
---

```{r pressure1, echo=FALSE}
library(DT)
library(r2resize)

add.resizer()

plot(mtcars)      # resize bar will not show up on image
#datatable(iris)  # uncomment this line and the resize bar will show up on the image

Sorry, the codeblock should have ``` as the last line -- I have not figured out how to place code markers inside of code markers.

Failure to see the resizer toolbar

In a Quarto document, I have the following:

---
title: "Imaging of lung edema"
filters:
  - lightbox
author: "Howard Mann"
date: "2023-01-15"
description: "In this introduction to imaging features of lung edema I will distinguish primarily between *hydrostatic* and *acute lung injury* edema, and explain under what circumstances it may be difficult to determine which is present without clinical context."
image: thumbnail.jpg
page-layout: full
---

`library(r2resize)`

`r2resize::add.resizer()`

The above is printed in the output.

Nothing else happens.

I'm clearly naive and doing something wrong.

What is it ?

Cheers.

Setting images, tables to FALSE does not remove resize bar

Hi there,

I still get toolbars on images and table after I set tables and images to FALSE in add.resizer().

I am using R 4.3.2, RStudio 2023.12.1 (402), Quarto 1.4.533, Windows 11

thanks again,
Charlie

---
title: "test r2resize"
format: html
---

```{r pressure1}
library(DT)
library(r2resize)

add.resizer(
  tables = FALSE,   
  images = FALSE
)

plot(mtcars)
datatable(iris)

Once again, sorry, the final line in the codeblock should be ```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.