Week23 - flowtypeR
June 17, 2015
htmlwidgets News This Week
I can’t keep up with all that is happening in widget-world, so for all the newest and updated htmlwidgets
, just do this Github search, and you’ll quickly get up to date.
This Week’s Widget - flowtypeR
flowtypeR
attempts to make your R output more readable. Simply include the flowtype()
in your htmltools::tagList
.
Quick Installation
flowtypeR
is not yet on CRAN and won’t be unless someone asks, so for now please install with devtools::install_github
.
# should move to master soon
devtools::install_github("timelyportfolio/flowtypeR")
Example from FlowTypeJS
The expert developers at simplefocus put together a far nicer example than I could, so I have embedded it below.
Example from R
Now for something a little more R-like. Using about.html
that is in your R system directory, we can do a side by side comparison of the flowtype-effect. Resize your browser window to see how flowtype adjusts the text size so that there are a more optimal number of words per line.
# using about.html from R help
library("flowtypeR")
library("htmltools")
library("shiny")
# read about.html from the R system help directory
about_html <- readLines(file.path(R.home("doc/html"),"about.html"))
browsable(
tagList(
bootstrapPage(
tags$div(class="row"
,tags$div(class="col-xs-6"
,tags$h1("with flowtype")
,tags$div(
id="flowtype-resize"
,style="padding:0em 1em 0em 1em; border: 2px solid gray;"
,HTML(
about_html[do.call(seq,as.list(grep(x=about_html,pattern="<h2>")+c(0,-1)))]
)
)
)
,tags$div(class="col-xs-6"
,tags$h1("without flowtype")
,tags$div(id="flowtype-resize"
,style="padding:0em 1em 0em 1em; border: 2px dashed gray;"
,HTML(
about_html[do.call(seq,as.list(grep(x=about_html,pattern="<h2>")+c(0,-1)))]
)
)
)
)
)
,flowtype(
'#flowtype-resize'
,minFont = 12
,fontRatio = 20
)
)
)
Thanks
Thanks so much
- simplefocus team for
flowtype.js
- Ramnath Vaidyanathan and RStudio for
htmlwidgets
- all the contributors to
R
andJavaScript