pagemapR

R build status CRAN_Status_Badge metacran downloads

Introduction

This is an R package that provides support for pagemap as a htmlwidgets.
Quickly and easily add a mini map to your rmarkdown html documents. See a demonstration here.

Note: To distinguish it from the original project pagemap, the name of this project is pagemapR, but the package name is pagemap.

Installation

install.packages("pagemap")

Or use devtools to install the latest development version.

# install.packages("devtools")
devtools::install_github("swsoyee/pagemapR")

Usage

It’s very simple to use.

library(pagemap)
pagemap()

You could fix it’s position on the screen and style by providing a list of css property.

pagemap(
  id = "mini_map",
  box_style = list(left = "5px", top = "10px")
)

You could also customize the internal style of the mini map through the API provided by pagemap.

pagemap(
  id = "mini_map",
  styles = list(
    "h1,h2,a,code" = "rgba(0, 0, 0, 0.10)",
    "img" = "rgba(0, 0, 0, 0.08)",
    "pre" = "rgba(0, 0, 0, 0.04)"
  )
)

Or add a pagemap for your Shiny app:

if (interactive()) {
  shinyApp(
    ui = fluidPage(pagemapOutput("pagemap")),
    server = function(input, output) {
      output$pagemap <- renderPagemap(pagemap())
    }
  )
}

Credit

This package is thanks to the work done by Lars Jung (https://github.com/lrsjng), the author of the original Javascript package pagemap. Also, thanks should also go to Ramnath Vaidyanathan, Kenton Russell, and RStudio, Inc. for the amazing work on create htmlwigets package. The hex sticker of pagemapis produced by hexSticker and ggplot2, so special thanks goes to the Guangchuang YU (https://guangchuangyu.github.io) and the ggplot2 development team.

Contact

You are welcome to:

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.