Nat  Grady

Nat Grady

1667994420

Summarytools: R Package to Quickly and Neatly Summarize Data

Summarytools 1.0 is out!

summarytools is a an R package for data cleaning, exploring, and simple reporting. The package was developed with the following objectives in mind:

  • Provide a coherent set of easy-to-use descriptive functions that are akin to those included in commercial statistical software suites such as SAS, SPSS, and Stata
  • Offer flexibility in terms of output format & content
  • Integrate well with commonly used software & tools for reporting (the RStudio IDE, Rmarkdown, and knitr) while also allowing for standalone, simple report generation from any R interface

On a more personal level, I simply wish to share with the R community and the scientific community at large the functions I first developed for myself, that I ultimately realized would benefit a lot of people who are looking for the same thing I was seeking in the first place.

Package Documentation

The bulk of the technical documentation can now be found in the following vignettes:

Introduction to summarytools | CRAN version
Summarytools in R Markdown | CRAN Version
PDF Manual (automatically generated by CRAN)

Installing summarytools

Required Software

Additional software is used by summarytools for fine-tuning graphics as well as offering interactive functionality. If you are installing summarytools for the first time, click on the relevant link to get OS-specific instructions. On Windows, no additional software is required.

Mac OS X
Ubuntu / Debian / Mint
Older Ubuntu (14 and 16)
Fedora / Red Hat / CentOS
Solaris

Installing From GitHub

This method has the advantage of benefiting from minor fixes and improvements that are added between CRAN releases. Its main drawback is that you won’t be noticed when a new version is available. You can either check this page from time to time, or best, use a package that checks for package updates on various repositories, such as dtupdate and Drat.

install.packages("remotes")        # Using devtools is also possible
library(remotes)
install_github("rapporter/pander") # Strongly recommended
install_github("dcomtois/summarytools", build_vignettes = TRUE)

Installing From CRAN

CRAN versions are stable but are not updated as often as the GitHub versions. On the plus side, they can be easier to install on some systems.

install.packages("summarytools")

Latest Changes

In dfSummary():

  • It is now possible to control which statistics to show in the Freqs / Values column (see help("st_options", "summarytools") for examples)
  • In html outputs, tables are better aligned horizontally (categories >> counts >> charts); if misalignment occurs, adjusting graph.magnif should resolve it
  • List-type columns and Inf values are handled properly

In descr() and ctable() several display glitches were corrected

Selected heading elements can be totally omitted on an individual basis

Improved functionality for customized terms / translations

For more details, see vignette("introduction", "summarytools") as well as news(package = "summarytools").

Additional Software Installations

Required Software on Mac OS

Magick++

Open a terminal window and enter the following:

brew install imagemagick@6

If you do not have brew installed, simply enter this command in the terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

XQuartz

If you’re using Mac OS X version 10.8 (Mountain Lion) or more recent versions, you’ll need to download the .dmg image from xquartz.org and add it to your Applications folder.

Required Software for Debian / Ubuntu / Linux Mint

Magick++
sudo apt install libmagick++-dev

Required Software for Older Ubuntu Versions

This applies only if you are using Ubuntu Trusty (14.04) or Xenial (16.04).

Magick++

sudo add-apt-repository -y ppa:opencpu/imagemagick
sudo apt-get update
sudo apt-get install -y libmagick++-dev

Required Software for Fedora / Red Had / CentOS

Magick++
sudo yum install ImageMagick-c++-devel

Required Software for Solaris

Magick++

pkgadd -d http://get.opencsw.org/now
/opt/csw/bin/pkgutil -U
/opt/csw/bin/pkgutil -y -i imagemagick 
/usr/sbin/pkgchk -L CSWimagemagick

Download Details:

Author: Dcomtois
Source Code: https://github.com/dcomtois/summarytools 

#r #markdown #rstudio 

Summarytools: R Package to Quickly and Neatly Summarize Data
Nat  Grady

Nat Grady

1667507760

Postcards: Create Simple, Beautiful Personal Websites & Landing Pages

Postcards

Create simple, beautiful personal websites and landing pages using only R Markdown.

Installation

You can install Postcards with the following command:

install.packages("postcards")

Or you can install the latest development version:

remotes::install_github("seankross/postcards@main")

Getting Started

Postcards includes five templates: Jolla, Jolla Blue, Trestles, Onofre, and Solana. Each site is optimized for being displayed on desktop and mobile. The goal of the package is to make it easy for anyone to create a single page personal website with one R Markdown document. I hope this package can quickly demonstrate the power and possibilities of the R and R Markdown ecosystem to newcomers.

To get started customizing one of these templates you should create a new project in RStudio. Once you open RStudio: select File, New Project..., then select New Directory, and Postcards Website. Then you will need to enter a directory name for your RStudio project and you can choose one of the templates from a drop down menu. Select Create Project after you choose a name for the folder that will contain your site. This folder will contain two important files: an R Markdown document with your site's content, and a sample photo that you should replace.

If you are not using RStudio or if you do not wish to create a new RStudio project you can create the corresponding template files using the following commands:

postcards::create_postcard(template = "jolla")
postcards::create_postcard(template = "jolla-blue")
postcards::create_postcard(template = "trestles")
postcards::create_postcard(template = "onofre")
postcards::create_postcard(template = "solana")

To compile the self contained HTML file for your site, you can use the Knit button in RStudio or you can use rmarkdown::render("index.Rmd"). The HTML file can then be easily deployed to GitHub Pages or Netlify Drop.

The Templates

Jolla

---
title: "Tobi Burns"
image: "tobi.jpg"
links:
  - label: LinkedIn
    url: "https://linkedin.com/"
  - label: Twitter
    url: "https://twitter.com/"
  - label: GitHub
    url: "https://github.com/"
  - label: Email
    url: "mailto:email@email.com"
output:
  postcards::jolla
---
 
I am a classically trained data scientist living in the San Francisco Bay Area. 
Currently I work on the Oculus team at Facebook. I love talking about baseball, 
true crime podcasts, and causal inference.

Jolla Blue

---
title: "Xiang Guo"
image: "xiang.jpg"
links:
  - label: LinkedIn
    url: "https://linkedin.com/"
  - label: Twitter
    url: "https://twitter.com/"
  - label: GitHub
    url: "https://github.com/"
  - label: Email
    url: "mailto:email@email.com"
output:
  postcards::jolla_blue
---
 
Raised in New Jersey by two lawyers, I am now an aspiring data artist and 
competitive rock climber. I moved to Seattle to fly floatplanes, but I got 
caught up in the startup world. Send me a WhatsApp message if you have good 
turnip prices.

Trestles

---
title: "Frank Hermosillo"
image: "frank.jpg"
links:
  - label: LinkedIn
    url: "https://linkedin.com/"
  - label: Twitter
    url: "https://twitter.com/"
  - label: GitHub
    url: "https://github.com/"
  - label: Email
    url: "mailto:email@email.com"
output:
  postcards::trestles
---
 
## Bio

Frank Hermosillo studies neural networks and their applications at Google 
Brain. His research focuses on differentiable network pruning approximation and 
decentralized gradient inversion mechanics. He frequently collaborates with 
researchers who study machine learning, computer vision, and cognitive science.
His work has been featured in WIRED, The Atlantic, Newsweek, and The New York 
Times Magazine.

## Education

**Massachusetts Institute of Technology** | Cambridge, MA

Ph.D. in Computer Science | September 2009 - May 2014

**The University of California, Berkeley** | Berkeley, CA

B.S. in Computer Science | September 2005 - May 2009

## Experience

**Google Brain** | Principal Investigator | January 2018 - Present

**Netflix** | Research Scientist | June 2014 - December 2017

Onofre

---
title: "Willkommen!"
image: "herzl.jpg"
color1: "#5A59A3"
color2: "#C66060"
angle: 130
links:
  - label: YouTube
    url: "https://youtube.com/"
  - label: Vimeo
    url: "https://vimeo.com/"
  - label: Twitter
    url: "https://twitter.com/"
  - label: Email
    url: "mailto:email@email.com"
output:
  postcards::onofre
---
 
György Herzl is a filmmaker and computational storyteller based in Leipzig,
Germany. Their work has been featured at the Festival do Rio, Internationale
Filmfestspiele Berlin, Kunsthalle Basel, and the New Museum of Contemporary Art
in New York City. "ГУМ" is their latest project which examines the rise of
consumerism in post-Soviet republics.

Solana

---
title: "Sigríður Björndotter"
image: "sigridur.jpg"
links:
  - label: Resume
    url: "https://linkedin.com/"
  - label: Blog
    url: "https://medium.com/"
  - label: SoundCloud
    url: "https://soundcloud.com/"
  - label: Twitter
    url: "https://twitter.com/"
output:
  postcards::solana
---
 
## Bio

Sigríður Björndotter is a musician, vocalist, and live entertainment consultant
living in Buenos Aires, Argentina. Her writing has appeared in Rolling Stone,
Billboard, and NME, and she is a frequent contributor to National Public Radio's 
*All Songs Considered*. She has been raising Pembroke Welsh Corgis since the age
of six, and she has collected Casio watches since the age of ten.

## Education

**INSEAD** | Fontainebleau, France

M.B.A. | August 2014 - June 2015

**The Juilliard School** | New York, NY

B.F.A. in Music Performance | August 2005 - May 2009

## Experience

**Freelance** | Live Entertainment Consultant | August 2018 - Present

**Cercle** | Producer | August 2018 - Present

**National Public Radio** | Producer | May 2015 - July 2018

**NME Magazine** | Editor | July 2014 - July 2016

**Iceland Symphony Orchestra** | Cellist | October 2009 - June 2014

Troubleshooting

Most issues that people have using this package are related their installation Pandoc, software that R Markdown relies on. Currently Postcards works best with Pandoc version 2.8 or greater, although we are working on better functionality for earlier versions of Pandoc. You can check which version of Pandoc you have installed with the following command:

rmarkdown::pandoc_version()

If you have an earlier version of Pandoc installed we recommend you install the latest version of Pandoc and then run the command:

rmarkdown::find_pandoc(cache = FALSE)

If you do not see that the new Pandoc version has been installed, you may need to use RStudio and install the latest preview release of RStudio. If you are still encountering error messages after trying the above please open an issue.

Code of Conduct

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

Download Details:

Author: Seankross
Source Code: https://github.com/seankross/postcards 
License: Unknown, MIT licenses found

#r #rstudio #markdown 

Postcards: Create Simple, Beautiful Personal Websites & Landing Pages
Nat  Grady

Nat Grady

1667452500

Learnr: Interactive Tutorials with R Markdown

learnr 

The learnr package makes it easy to turn any R Markdown document into an interactive tutorial. Tutorials consist of content along with interactive components for checking and reinforcing understanding. Tutorials can include any or all of the following:

Narrative, figures, illustrations, and equations.

Code exercises (R code chunks that users can edit and execute directly).

Quiz questions.

Videos (supported services include YouTube and Vimeo).

Interactive Shiny components.

Tutorials automatically preserve work done within them, so if a user works on a few exercises or questions and returns to the tutorial later they can pick up right where they left off.

Learn more about the learnr package and try example tutorials online at https://rstudio.github.io/learnr/.

Installation

Install the latest official learnr release from CRAN:

install.packages("learnr")

Or you can install the most recent version in-development from GitHub with the remotes package:

# install.packages("remotes")
remotes::install_github("rstudio/learnr")

learnr works best with a recent version of RStudio (v1.0.136 or later) which includes tools for easily running and previewing tutorials.

Download Details:

Author: View license
Source Code: https://github.com/rstudio/learnr 
License: View license

#r #rstudio #python #tutorial #sql

Learnr: Interactive Tutorials with R Markdown
Nat  Grady

Nat Grady

1667378295

ModernDive_book: Statistical inference Via Data Science

ModernDive

Welcome to the GitHub repository page for Statistical Inference via Data Science: A ModernDive into R and the Tidyverse available at ModernDive.com. You can purchase the CRC Press print edition on their website using promo code ADC22 for a discounted price.

Contents of this Repository

ModernDive is built using RStudio's bookdown package; for more information on how to use bookdown see bookdown.org. If you'd like to build the book on your own, please make sure to first install the bookdown package via install.packages("bookdown").

  • The bookdown source code for the current version of the book is in the master branch of this repo.
  • The bookdown source code for all previously released versions of ModernDive is accessible on the Releases page. A summary of all changes between versions can be found in NEWS.md.
  • The contents of moderndive.com are deployed via Netlify from the gh-pages branch of this repo.

We are also slowly working on a future version of ModernDive:

  • The bookdown source code for the future version of the book is in the v2 branch of this repo.
  • A preview of the future version is available at moderndive.netlify.app.

More Information

Download Details:

Author: Moderndive
Source Code: https://github.com/moderndive/ModernDive_book 
License: View license

#r #datascience #rstudio 

ModernDive_book: Statistical inference Via Data Science
Nat  Grady

Nat Grady

1667358360

Rmdformats: HTML Output formats For RMarkdown Documents

rmdformats

This R package provides ready-to-use HTML output formats and templates for RMarkdown documents. The goal is to produce clean documents "out of the box", with or without the RStudio IDE.

Formats gallery

The package provides several HTML output formats. Click on any image to see an HTML output sample.

downcute

Taken from the docute project theme and its adaptation by John Coene. Responsive, with a dynamic table of contents and a dark theme switcher.

downcute example

downcute chaos is a variation created by Zac Garland. It has a slightly different color theme, and defaults to dark mode. To use it, add a downcute_theme: "chaos" option in your YAML preamble.

downcute chaos example

robobook

Adapted from the bookdown theme, with Roboto family fonts. Fully responsive with dynamic table of contents and collapsible navigation.

robobook example

material

Format taken from the Material design theme for Bootstrap 3. Document is split into pages at each <h1> header, and the table of contents allows an animated navigation between these pages (you can use the cards: false preamble parameter to disable the splitting and display all the cards at once).

material example

readthedown

Adapted from the corresponding readtheorg theme of the org-html-themes project, fully responsive with dynamic table of contents and collapsible navigation.

readthedown example

html_clean

Simple and clean template with dynamic table of contents, very similar to the one from the great knitrBootstrap package by Jim Hester.

html_clean example

html_docco

Simple template, no table of contents. CSS heavily inspired from the default one of the docco project.

html_docco example

lockdown

lockdown is an exact copy of the default RMarkdown html_document template, with an added functionality : each time you click on a link to get out, you'll see a friendly reminder to wash your hands and wear a mask. Yes, it is a (bad) attempt at a (bad) joke, sorry !

lockdown example

Features and helpers

Features matrix

 ResponsiveDynamic TOCDark modeThumbnails / LightboxCode foldingTabsetsBad joke
html_doccox  xxx 
html_cleanxx xxx 
readthedownxx  xx 
material   xxx 
robobookxx xxx 
downcutexxxxxx 
lockdown      x

Helpers

The package also provides RStudio document templates to easily generate an empty and ready to use rmarkdown file with several configuration directives.

It also provides the pilltabs() helper function, which allows to display a crosstab dynamically. See one of the output samples for a live example.

Installation

You can install the latest stable release from CRAN :

install.packages("rmdformats")

Or the latest development snapshot from GitHub :

install.packages(remotes)  # if necessary
remotes::install_github("juba/rmdformats")

Creating a new document

Just create a new Rmd file and add the following in your YAML preamble :

---
output: rmdformats::<template name>
---

Within RStudio , you can also choose File > New File... > R Markdown..., then select From Template. You should then be able to create a new document from one of the package templates.

Options

Depending on the features provided by the template, you can add the following options to your YAML preamble. Look at the template function help page for a valid list :

  • fig_width : figures width, in inches
  • fig_height : figures height, in inches
  • fig_caption : toggle figure caption rendering
  • highlight : syntax highlighting
  • thumbnails : if TRUE, display content images as thumbnails
  • lightbox : if TRUE, add lightbox effect to content images
  • gallery : if TRUE, add navigation between images when displayed in lightbox
  • use_bookdown : if TRUE, will use bookdown instead of rmarkdown for HTML rendering, thus providing section numbering and cross references.
  • embed_fonts : if TRUE (default), use local files for fonts used in the template instead of links to Google Web fonts. This leads to bigger files but ensures that the fonts are available
  • additional aguments are passed to the base html_document RMarkdown template

Example preamble :

---
title: "My document"
date: "`r Sys.Date()`"
author: John Doe
output:
  rmdformats::downcute:
    self_contained: true
    thumbnails: true
    lightbox: true
    gallery: false
    highlight: tango
---

Credits

  • Magnific popup lightbox plugin
  • The CSS for the html_docco format is heavily inspired from the default one of the docco project.
  • The CSS and JavaScript for readthedown is adapted from the corresponding readtheorg theme of the org-html-themes project, which is itself inspired by the Read the docs Sphinx theme.
  • The CSS and JavaScript for material has been taken from the Material design theme for Bootstrap 3 project and its presentation page.
  • The CSS for robobook is directly derived from the bookdown project template.
  • The CSS for downcute is directly derived from the default theme of the docute project and its adaptation by John Coene for some of its projects documentation.
  • The downcute chaos theme has been created by Zac Garland.
  • JavaScript and HTML code for code folding and tabbed sections are taken from the RStudio's default rmarkdown HTML template.
  • The html_clean styling and features are very similar to the ones from the knitrBootstrap package by Jim Hester.

Download Details:

Author: juba
Source Code: https://github.com/juba/rmdformats 

#r #html #material #rstudio 

Rmdformats: HTML Output formats For RMarkdown Documents
Nat  Grady

Nat Grady

1666965840

Pagedown: Paginate The HTML Output Of R Markdown with CSS for Print

Pagedown

Paginate the HTML Output of R Markdown with CSS for Print. You only need a modern web browser (e.g., Google Chrome or Microsoft Edge) to generate PDF. No need to install LaTeX to get beautiful PDFs.

This R package stands on the shoulders of two giants to support typesetting with CSS for R Markdown documents: Paged.js and ReLaXed (we only borrowed some CSS from the ReLaXed repo and didn't really use the Node package).

You may install this package from Github:

remotes::install_github('rstudio/pagedown')

This package requires a recent version of Pandoc (>= 2.2.3). If you use RStudio, you are recommended to install the latest version (>= 1.2.1335), which has bundled Pandoc 2.x, otherwise you need to install Pandoc separately.

Below are some existing R Markdown output formats and examples.

Paged HTML documents (pagedown::html_paged)

A paged HTML document

Thesis (pagedown::thesis_paged)

A paged HTML thesis

Journal of Statistical Software article (pagedown::jss_paged)

A JSS article

Resume (pagedown::html_resume)

An HTML resume

You may want to check out the datadrivencv package, which allows you to build a CV using data from a spreadsheet and pagedown::html_resume.

Posters

pagedown::poster_relaxed

A poster of the ReLaXed style

pagedown::poster_jacobs

A poster of the Jacobs University style

Want more poster styles? You may take a look at Brent Thorne's posterdown package.

Business cards (pagedown::business_card)

A business card

Letters (pagedown::html_letter)

A letter in HTML

Other examples

Nick Strayer's CV: https://github.com/nstrayer/cv (also includes instructions on how to build your own CV).

"Template of Exec Summaries with pagedown" by Joshua David Barillas: https://github.com/jdbarillas/executive_summary

Ulrik Lyngs's CVs: https://ulyngs.github.io/pagedown-cv/

Jiena Gu McLellan's CV: https://github.com/jienagu/Jiena_McLellan_CV

Thomas Vroylandt's template for the French Scouts and Guides Association: https://github.com/tvroylandt/sgdf_pagedown

Beatriz Milz's CV: https://beatrizmilz.github.io/resume/resume.html

pagedreport by Thomas Vroylandt and David Keyes which helps using pagedown with some templates proposals: https://github.com/rfortherestofus/pagedreport

Jodavid Ferreira's CV (in Portuguese) : https://jodavid.github.io/cv/ (source: https://github.com/jodavid/cv)

Authors and contributors

The main authors of this package are Yihui Xie (RStudio) and Romain Lesur. Romain has received a grant from the Shuttleworth Foundation for his work on both Paged.js and pagedown.

Shuttleworth Funded

You can find the full list of contributors of pagedown here. We always welcome new contributions. In particular, if you are familiar with CSS, we'd love to include your contributions of more creative and beautiful CSS stylesheets in this package. It is also very helpful if you don't know CSS but just tell us the creative and beautiful web pages you have seen, since other CSS experts may be able to port them into pagedown.

Download Details:

Author: rstudio
Source Code: https://github.com/rstudio/pagedownrstudio 
License: Unknown, MIT licenses found

#r #rstudio #css #html #pdf 

Pagedown: Paginate The HTML Output Of R Markdown with CSS for Print
Nat  Grady

Nat Grady

1666879469

Rticles: LaTeX Journal Article Templates for R Markdown

rticles

The rticles package provides a suite of custom R Markdown LaTeX formats and templates for various formats. Most of the templates are provided and maintained by the community, and anyone can contribute a new template. See How to contribute below.

Installation

You can install and use rticles from CRAN as follows:

install.packages("rticles")

If you wish to install the development version from GitHub (which often contains new article formats), you can do this:

remotes::install_github("rstudio/rticles")

Using rticles

To use rticles from RStudio, you can access the templates through File -> New File -> R Markdown. This will open the dialog box where you can select from one of the available templates:

New R
Markdown

If you are not using RStudio, you’ll also need to install Pandoc following these instructions. Then, use the rmarkdown::draft() function to create articles:

rmarkdown::draft(
    "MyJSSArticle.Rmd", template = "jss", package = "rticles"
)
rmarkdown::draft(
    "MyRJournalArticle", template = "rjournal", package = "rticles"
)

This will create a folder containing a Rmd file using the corresponding output format and all the assets required by this format.

Templates

Currently included templates and their contributors are the following:

JournalContributorsPull requestOutput format
ACM: Association for Computings Machinery@ramnathv#8acm_article()
ACS@yufree#15acs_article()
AEA: American Economic Association@sboysel#86aea_articles()
AGU@eliocamp#199agu_article()
AJS: Austrian Journal of Statistics@matthias-da#437ajs_article()
AMS: American Meteorological Society@yufree#96ams_article()
ASA: American Statistical Association https://www.amstat.org/ #111asa_article()
arXiv pre-prints based on George Kour’s template@alexpghayes#236arxiv_article()
Bioinformatics@ShixiangWang#297bioinformatics_article()
Biometrics@daltonhance#170biometrics_article()
Bulletin de l’AMQ@desautm#145amq_article()
Copernicus Publications@nuest, @RLumSK#172, #342copernicus_article()
CTeX  ctex()
Elsevier@cboettig, @robjhyndman#27, #467elsevier_article()
Frontiers@muschellij2#211frontiers_article()
Glossa@stefanocoretta#361glossa_article()
IEEE Transaction@Emaasit, @espinielli, @nathanweeks, @DunLug#97, #169, #227, #263, #264, #265ieee_article()
IMS: Institute of Mathematical Statistics AoAS: Annals of Applied Statistics@auzaheta#372ims_article()
INFORMS: Institute for Operations Research and the Management Sciences@robjhyndman#460informs_article()
ISBA: International Society for Bayesian Analysis@dmi3nko#461isba_article()
IOP: Institute of Physics (https://iopscience.iop.org)@robjhyndman#462iop_article()
JASA: Journal of the Acoustical Society of America@stefanocoretta#364jasa_article()
Journal of Educational Data Mining journal submissions@jooyoungseo#251jedm_article()
JOSS: Journal of Open Source Software JOSE: Journal of Open Source Education@noamross#229joss_article()
JSS: Journal of Statistical Software  jss_article()
LIPIcs@nuest#288lipics_article()
MDPI@dleutnant#147mdpi_article()
MNRAS: Monthly Notices of the Royal Astronomical Society@oleskiewicz#175mnras_article()
OUP: Oxford University Press@dmkaplan#284oup_articles()
PeerJ: Journal of Life and Environmental Sciences@zkamvar#127peerj_article()
PiHPh: Papers in Historical Phonology@stefanocoretta#362pihph_article()
PLOS@sjmgarnier#12plos_article()
PNAS: Proceedings of the National Academy of Sciences@cboettig#72pnas_article()
RSOS: Royal Society Open Science@ThierryO#135rsos_article()
RSS: Royal Statistical Society@carlganz#110rss_article()
Sage@oguzhanogreden#181sage_article()
Springer@strakaps#164springer_article()
Springer Lecture Notes in Computer Science (LCNS)@eliocamp#445lncs_article()
SIM: Statistics in Medicine@ellessenne#231sim_article()
Taylor & Francis@dleutnant#218tf_article()
The R Journal  rjournal_article()
TRB@gregmacfarlane#427trb_article()
Wellcome Open Research@arnold-c#436wellcomeor_article()

You can also get the list of available journal names with rticles::journals().

rticles::journals()
#>  [1] "acm"            "acs"            "aea"            "agu"           
#>  [5] "ajs"            "amq"            "ams"            "arxiv"         
#>  [9] "asa"            "bioinformatics" "biometrics"     "copernicus"    
#> [13] "ctex"           "elsevier"       "frontiers"      "glossa"        
#> [17] "ieee"           "ims"            "informs"        "iop"           
#> [21] "isba"           "jasa"           "jedm"           "joss"          
#> [25] "jss"            "lipics"         "lncs"           "mdpi"          
#> [29] "mnras"          "oup_v0"         "oup_v1"         "peerj"         
#> [33] "pihph"          "plos"           "pnas"           "rjournal"      
#> [37] "rsos"           "rss"            "sage"           "sim"           
#> [41] "springer"       "tf"             "trb"            "wellcomeor"

Those are the values to use within rmarkdown::draft().

Under the hood, LaTeX templates are used to ensure that documents conform precisely to submission standards. At the same time, composition and formatting can be done using lightweight markdown syntax, and R code and its output can be seamlessly included using knitr.

Getting help

There are two main places to get help:

The RStudio community is a friendly place to ask any questions about rticles. Be sure to use the rticles tag.

Stack Overflow is a great source of answers to common bookdown questions. Use the tags [r][rticles] if you ask a question.

Code of Conduct

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

How to contribute?

Most of the templates are contributed directly by the users in the community. If you want rticles to offer a new journal format, you can contribute by the following way.

Suggest an idea for new format opening an issue.

You may not feel confident enough or may not have time to contribute a new format. By opening a new issue, you can share the idea for this format, and see if someone in the community can help on it.
This is not the best way to quickly get your format included but at least it is a great way to see if others are interested too.

To see the existing suggested formats, just filter issues with the help wanted :heart: label. You can then add a :+1: or help to add the template :wink:.

Contribute a new template format opening a pull request.

To contribute a new format, you need to open a new pull request (PR). When opening the PR, you’ll see the PR template explaining how to proceed and what is important to check. Please follow it.
Even if you are just starting or you are not finished, you share your work by creating a draft PR. It is a great way to let us know that you are still working on it (like these opened ones), and it is also a great way to ask for help from the community.
When you are ready, you can submit the PR for review, and we will iterate until it is merged.

Technical resources helpful to contribute a template

The best way to get started is to look at the previous examples of submitted PR. You’ll find links to them in the table above.

All the rticles format are build similarly by providing a new pandoc tex template to replace the default one. You’ll learn more about pandoc templates in these places:

You can study existing formats to see how all this works.

Book

R Markdown: The Definitive Guide

Download Details:

Author: rstudio
Source Code: https://github.com/rstudio/rticles 

#r #rstudio #article  #markdown 

Rticles: LaTeX Journal Article Templates for R Markdown
Nat  Grady

Nat Grady

1666862520

Blogdown: Create Blogs and Websites with R Markdown

Blogdown

The goal of the blogdown package is to provide a powerful and customizable website output format for R Markdown. Use dynamic R Markdown documents to build webpages featuring:

R code (or other programming languages that knitr supports),

automatically rendered output such as graphics, tables, analysis results, and HTML widgets, and

technical writing elements such as citations, footnotes, and LaTeX math, enabled by the bookdown package.

By default, blogdown uses Hugo, a popular open-source static website generator, which provides a fast and flexible way to build your site content to be shared online. Other website generators like Jekyll and Hexo are also supported.

A useful feature of blogdown sites, compared to other R Markdown-based websites, is that you may organize your website content (including R Markdown files) within subdirectories. This makes blogdown a good solution not just for blogging or sites about R — it can also be used to create general-purpose websites to communicate about data science, statistics, data visualization, programming, or education.

Installation

You can install the package via CRAN as follows:

install.packages('blogdown')

If you want to use the development version of the blogdown package, you can install the package from GitHub via the remotes package:

remotes::install_github('rstudio/blogdown')

Usage

You may create a new site via the function blogdown::new_site() under an empty directory. It will create a skeleton site, download a Hugo theme from Github, add some sample content, launch a web browser and you will see the new site. The sample blog post hello-world.Rmd should be opened automatically, and you can edit it. The website will be automatically rebuilt and the page will be refreshed after you save the file.

If you use RStudio, you can create a new RStudio project for your website from the menu File -> New Project -> New Directory -> Website using blogdown.

The function blogdown::serve_site() may be the most frequently used function in this package. It builds the website, loads it into your web browser, and automatically refreshes the browser when you update the Markdown or R Markdown files. Do not use the command line hugo server to build or serve the site. It only understands plain Markdown files, and cannot build R Markdown.

You may not be satisfied with the default site created from new_site(). There are two things you may want to do after your first successful experiment with blogdown:

  1. Pick a Hugo theme that you like from https://themes.gohugo.io. All you need is its Github user and repository name, to be passed to the theme argument of new_site().
  2. Add more content (pages or posts), or migrate your existing website.

Getting help

There are two main places to get help:

The RStudio community is a friendly place to ask any questions about blogdown. Be sure to use the blogdown tag.

Stack Overflow is a great source of answers to common blogdown questions. Use the tags [r][blogdown] if you ask a question.

Code of Conduct

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

Book

blogdown: Creating Websites with R Markdown

Download Details:

Author: rstudio
Source Code: https://github.com/rstudio/blogdown 

#r #rstudio #hugo 

Blogdown: Create Blogs and Websites with R Markdown
Nat  Grady

Nat Grady

1665474900

Monaco: Yet another Second Editor in RStudio

Monaco: the Monaco editor as a HTML widget

Yet another second editor in RStudio.

The Monaco editor is the code editor which powers 'VS Code'. It is particularly well developed for JavaScript. In addition to the built-in features of the Monaco editor, the widget allows to prettify multiple languages, to view the HTML rendering of Markdown code, and to view and resize SVG images.

With the help of htmltools::browsable, one can open two Monaco editors in the RStudio viewer pane:

The Monaco editor has many options. If you would like some of them to be available in the monaco package, please fill an issue.

As any HTML widget, the Monaco editor widget can be used in Shiny apps:

This app uses the sass package to compile some SCSS code to CSS code. It is one of the examples provided in the monaco package.

Related projects

  • shinyMonacoEditor: the Monaco editor in a sophisticated Shiny app. It is more developed than the monaco widget but using the Shiny app locks RStudio.
  • aceEditor: the Ace editor as a HTML widget.

Download Details:

Author: stla
Source Code: https://github.com/stla/monaco 
License: View license

#r #rstudio #another #second #editor 

Monaco: Yet another Second Editor in RStudio
Nat  Grady

Nat Grady

1665471060

aceEditor: A Second Editor in RStudio

aceEditor

A second editor in RStudio!

This package makes available the Ace editor as a HTML widget.

It also makes available the Ace diff editor, which highlights the differences between two files:

Related project: monaco, the Monaco editor as a HTML widget. The Monaco editor has more features for JavaScript, CSS, and related languages (JSX, SCSS, TypeScript). The Ace editor has support for more languages.

Download Details:

Author: stla
Source Code: https://github.com/stla/aceEditor 
License: View license

#r #rstudio #editor 

aceEditor: A Second Editor in RStudio
Nat  Grady

Nat Grady

1661581500

Pool: Object Pooling in R

pool

Database Connection Pooling in R  

The goal of the pool package is to abstract away the logic of connection management and the performance cost of fetching a new connection from a remote database. These concerns are especially prominent in interactive contexts, like Shiny apps (which connect to a remote database) or even at the R console. So, while this package is of most practical value to Shiny developers, there is no harm if it is used in other contexts. Since pool integrates with both DBI and dplyr, there are very few things that will be new to you, if you're already using either of those packages. Essentially, you shouldn't feel the difference, with the exception of creating and closing a Pool object (as opposed to connecting and disconnecting a DBIConnection object).

Usage

Here’s a simple example of using a pool within a Shiny app (feel free to try it yourself):

library(shiny)
library(dplyr)
library(pool)

pool <- dbPool(
  drv = RMySQL::MySQL(),
  dbname = "shinydemo",
  host = "shiny-demo.csa7qlmguqrf.us-east-1.rds.amazonaws.com",
  username = "guest",
  password = "guest"
)
onStop(function() {
  poolClose(pool)
})

ui <- fluidPage(
  textInput("ID", "Enter your ID:", "5"),
  tableOutput("tbl"),
  numericInput("nrows", "How many cities to show?", 10),
  plotOutput("popPlot")
)

server <- function(input, output, session) {
  output$tbl <- renderTable({
    pool %>% tbl("City") %>% filter(ID == !!input$ID) %>% collect()
  })
  output$popPlot <- renderPlot({
    df <- pool %>% tbl("City") %>% head(input$nrows) %>% collect()
    pop <- df$Population
    names(pop) <- df$Name
    barplot(pop)
  })
}

shinyApp(ui, server)

Concept

The pool package adds a new level of abstraction when connecting to a database: instead of directly fetching a connection from the database, you will create an object (called a pool) with a reference to that database. The pool holds a number of connections to the database. Some of these may be currently in-use and some of these may be idle, waiting for a query to request them. Each time you make a query, you are querying the pool, rather than the database. Under the hood, the pool will either give you an idle connection that it previously fetched from the database or, if it has no free connections, fetch one and give it to you. You never have to create or close connections directly: the pool knows when it should grow, shrink or keep steady. You only need to close the pool when you’re done.

Context and motivation

When you’re connecting to a database, it is important to manage your connections: when to open them (taking into account that this is a potentially long process for remote databases), how to keep track of them, and when to close them. This is always true, but it becomes especially relevant for Shiny apps, where not following best practices can lead to many slowdowns (from inadvertently opening too many connections) and/or many leaked connections (i.e. forgetting to close connections once you no longer need them). Over time, leaked connections could accumulate and substantially slow down your app, as well as overwhelming the database itself.

Oversimplifying a bit, we can think of connection management in Shiny as a spectrum from the extreme of just having one connection per app (potentially serving several sessions of the app) to the extreme of opening (and closing) one connection for each query you make. Neither of these approaches is great. You can expand either of the arrows below to see the source code for each extreme, but that is not essential to understanding the problems described below.

oneConnectionPerApp.R

library(shiny)
library(dplyr)
library(DBI)

conn <- dbConnect(
    drv = RMySQL::MySQL(),
    dbname = "shinydemo",
    host = "shiny-demo.csa7qlmguqrf.us-east-1.rds.amazonaws.com",
    username = "guest",
    password = "guest"
  )
onStop(function() {
  dbDisconnect(conn)
})

ui <- fluidPage(
  textInput("ID", "Enter your ID:", "5"),
  tableOutput("tbl"),
  numericInput("nrows", "How many cities to show?", 10),
  plotOutput("popPlot")
)

server <- function(input, output, session) {
  output$tbl <- renderTable({
    conn %>% tbl("City") %>% filter(ID == !!input$ID) %>% collect()
  })
  output$popPlot <- renderPlot({
    df <- conn %>% tbl("City") %>% head(input$nrows) %>% collect()
    pop <- df$Population
    names(pop) <- df$Name
    barplot(pop)
  })
}

shinyApp(ui, server)

oneConnectionPerQuery.R

library(shiny)
library(dplyr)
library(DBI)

args <- list(
  drv = RMySQL::MySQL(),
  dbname = "shinydemo",
  host = "shiny-demo.csa7qlmguqrf.us-east-1.rds.amazonaws.com",
  username = "guest",
  password = "guest"
)

ui <- fluidPage(
  textInput("ID", "Enter your ID:", "5"),
  tableOutput("tbl"),
  numericInput("nrows", "How many cities to show?", 10),
  plotOutput("popPlot")
)

server <- function(input, output, session) {
  output$tbl <- renderTable({
    conn <- do.call(dbConnect, args)
    on.exit(dbDisconnect(conn))

    conn %>% tbl("City") %>% filter(ID == !!input$ID) %>% collect()
  })
  output$popPlot <- renderPlot({
    conn <- do.call(dbConnect, args)
    on.exit(dbDisconnect(conn))

    df <- conn %>% tbl("City") %>% head(input$nrows) %>% collect()
    pop <- df$Population
    names(pop) <- df$Name
    barplot(pop)
  })
}

shinyApp(ui, server)

Opening only one connection per app makes it fast (because, in the whole app, you only fetch one connection) and your code is kept as simple as possible. However:

  • it cannot handle simultaneous requests (e.g. two sessions open, both querying the database at the same time);
  • if the connection breaks at some point (maybe the database server crashed), you won’t get a new connection (you have to exit the app and re-run it);
  • finally, if you are not quite at this extreme, and you use more than one connection per app (but fewer than one connection per query), it can be difficult to keep track of all your connections, since you’ll be opening and closing them in potentially very different places.

While the other extreme of opening (and closing) one connection for each query you make resolves all of these points, it is terribly slow (each time we need to access the database, we first have to fetch a connection), and you need a lot more (boilerplate) code to connect and disconnect the connection within each reactive/function.

The pool package was created so you don't have to worry about this at all. Since pool abstracts away the logic of connection management, for the vast majority of cases, you never have to deal with connections directly. Since the pool “knows” when it should have more connections and how to manage them, you have all the advantages of the second approach (one connection per query), without the disadvantages. You are still using one connection per query, but that connection is always fetched and returned to the pool, rather than getting it from the database directly. This is a whole lot faster and more efficient. Finally, the code is kept just as simple as the code in the first approach (only one connection for the entire app). In fact, if you look back at the pool Shiny app example above, you will notice that the code structure is essentially the same that you'd use to open a connection at the start of an app and close it at the end.

More resources

  • db.rstudio.com for a lot of best practices, articles and demos on databases in R and in RStudio.
  • shiny.rstudio.com to learn more about Shiny (there are also more articles, including on data and databases in /articles).

Download Details:

Author: rstudio
Source Code: https://github.com/rstudio/pool 

#r #rstudio #object 

Pool: Object Pooling in R
Nat  Grady

Nat Grady

1661514327

DT: R interface to The JQuery Plug-in DataTables

An R interface to the DataTables library

This package provides a function datatable() to display R data via the DataTables library (N.B. not to be confused with the data.table package).

Installation

You may install the stable version from CRAN, or the development version using remotes:

# install from CRAN
install.packages('DT')

# or the development version if necessary
remotes::install_github('rstudio/DT')

# then try DT::datatable(iris) as a hello world example

See the full documentation at https://rstudio.github.io/DT/. Please use Github issues only if you want to file bug reports or feature requests, and you are expected to ask questions on StackOverflow with at least the tags r and dt.

Download Details:

Author: rstudio
Source Code: https://github.com/rstudio/DT 
License: View license

#r #rstudio #javascript #datatable 

DT: R interface to The JQuery Plug-in DataTables
Nat  Grady

Nat Grady

1661362740

Shinysnippets: A Series Of Shiny Related RStudio Snippets

shinysnippets

The goal of shinysnippets is to save development time while taking advantage of Rstudio snippets for Shiny applications.

Installation of snippets

Via the package

You can install the dev of {shinysnippets} from GitHub:

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

Then run:

shinysnippets::add_snippets()

You’ll be asked to validate the writing of the snippets in ~/.R/snippets/r.snippets.

Restart RStudio to make these snippets effective.

Manually

Copy and paste these snippets to Tools > Global Options > Code > Editing > Edit Snippets.

Snippets list

Modules

snippet module
    ${1:name}ui <- function(id){
        ns <- NS(id)
        tagList(
        
            )
        }

    ${1:name} <- function(input, output, session){
        ns <- session\$ns
    }
    
    # Copy in UI
    ${1:name}ui("${1:name}ui")
    
    # Copy in server
    callModule(${1:name}, "${1:name}ui")
module_snippet.gif

observeEvent

snippet observe_event
    observeEvent( ${1:event} , {
    
    })
observeEvent_snippet.gif

sidebar_page

snippet sidebar_page
    library(shiny)
    
    ui <- fluidPage(
      titlePanel( "${1:title}" ), 
      
      sidebarLayout(
        sidebarPanel(
        
        ),
        mainPanel(
        
        )
      )
    )
    
    server <- function(input, output, session) {
      
    }
    
    shinyApp(ui, server)
sidebarpage.gif

withProgress

snippet with_progress
    withProgress( message = "${1:message}" , {
    
    })
with_progress_snippet.gif

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

Download Details:

Author: ThinkR-open
Source Code: https://github.com/ThinkR-open/shinysnippets 
License: Unknown, MIT licenses found

#r #rstudio 

Shinysnippets: A Series Of Shiny Related RStudio Snippets
Nat  Grady

Nat Grady

1661294880

Shinytest: Automated Testing for Shiny Apps

shinytest  

shinytest provides a simulation of a Shiny app that you can control in order to automate testing. shinytest uses a snapshot-based testing strategy: the first time it runs a set of tests for an application, it performs some scripted interactions with the app and takes one or more snapshots of the application’s state. Subsequent runs perform the same scripted interactions then compare the results; you'll get an error if they're different.

Installation

To install the current release version:

install.packages("shinytest")

Usage

See the getting started guide to learn how to use shinytest.

Download Details:

Author: rstudio
Source Code: https://github.com/rstudio/shinytest 
License: View license

#r #rstudio #test 

Shinytest: Automated Testing for Shiny Apps
Nat  Grady

Nat Grady

1661232003

Easily insert FontAwesome Icons Into R Markdown Docs & Shiny Apps

The fontawesome R package makes it very easy to insert Font Awesome icons into R Markdown documents and Shiny apps (or, anywhere else you need to put them).

Examples

The fa() function can be used to insert an FA icon. For example, we can get the r-project icon in steelblue:

fa(name = "r-project", fill = "steelblue")
#> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 581 512" class="rfa" style="height:0.75em;fill:steelblue;position:relative;"><path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"/></svg>

As can be seen, what we really get from the function is an SVG object that represents the icon. This can be directly used within R Markdown with:

{text} `r fa(...)` {text}

Font Awesome SVG icons are great to use instead of <i> tags + font files for a few reasons:

  • There is less overhead in a Shiny app or R Markdown document since an <i> tag requires computation to obtain the icon (<svg> tags represent the actual icon)
  • Using <i> tags has a 'being online' requirement since network activity is necessary for resolving these tags (SVGs in fontawesome are stored in the package, so, no Internet connectivity is necessary for that)
  • There are styling options available for SVG that aren't there for icon fonts

R Markdown

Here is an example R Markdown document that includes Font Awesome icons:

---
title: "Font Awesome in R Markdown"
output: html_document
---

```{r load_packages, message=FALSE, warning=FALSE, include=FALSE} 
library(fontawesome)
```

# Just a few tests with `r fa("font-awesome-logo-full", fill = "forestgreen")`

It works well in headings...

# `r fa("r-project", fill = "steelblue")` H1 Heading

## `r fa("r-project", fill = "steelblue")` H2 Heading

### `r fa("r-project", fill = "steelblue")` H3 Heading

#### `r fa("r-project", fill = "steelblue")` H4 Heading

##### `r fa("r-project", fill = "steelblue")` H5 Heading

...and works equally well within inline text: `r fa("r-project", fill = "steelblue")`.

This will appear, when knit, as:

Shiny

Here’s a Shiny app (from the Shiny Gallery) that’s been slightly modified to incorporate Font Awesome icons in the text above the three search fields:

library(shiny)
library(DT)
library(ggplot2)
library(fontawesome)

ui <- fluidPage(

  titlePanel("Basic DataTable"),

  # Create a new Row in the UI for selectInputs
  fluidRow(

    column(
      width = 4,
      selectInput(
        inputId = "man",
        label = tags$p(fa("car", fill = "purple"), "Manufacturer:"),
        choices = c(
          "All",
          unique(as.character(mpg$manufacturer))))
    ),

    column(
      width = 4,
      selectInput(
        inputId = "trans",
        label = tags$p(fa("car", fill = "forestgreen"), "Transmission:"),
        choices = c(
          "All",
          unique(as.character(mpg$trans))))
    ),

    column(
      width = 4,
      selectInput(
        inputId = "cyl",
        label = tags$p(fa("car", fill = "steelblue"), "Cylinders:"),
        choices = c(
          "All",
          unique(as.character(mpg$cyl))))
    )
  ),

  # Create a new row for the table.
  fluidRow(
    dataTableOutput("table")
  )
)

server <- function(input, output) {

  # Filter data based on selections
  output$table <- renderDataTable({

    data <- mpg
    if (input$man != "All") {
      data <- data[data$manufacturer == input$man,]
    }
    if (input$cyl != "All") {
      data <- data[data$cyl == input$cyl,]
    }
    if (input$trans != "All") {
      data <- data[data$trans == input$trans,]
    }
    data
  })
}

shinyApp(ui = ui, server = server)

The Shiny app will look something like this:

Please note that using shiny::icon() in place of fontawesome::fa() will still work. Internally, the icon() function will call fontawesome's fa_i() function, which generates an old-school <i> tag for the icon.

Installation

Want to try this out? The fontawesome package can be installed from CRAN:

install.packages("fontawesome")

Also, you can install the development version of fontawesome from GitHub:

devtools::install_github("rstudio/fontawesome")

If you encounter a bug, have usage questions, or want to share ideas to make this package better, feel free to file an issue.

Code of Conduct

Please note that the rstudio/fontawesome project is released with a contributor code of conduct.
By participating in this project you agree to abide by its terms.

🏛️ Governance

This project is primarily maintained by Rich Iannone. Other authors may occasionally assist with some of these duties.

Download Details:

Author: rstudio
Source Code: https://github.com/rstudio/fontawesome 
License: Unknown, Unknown licenses found

#r #rstudio #markdown #docs 

 Easily insert FontAwesome Icons Into R Markdown Docs & Shiny Apps