Here is the r2social R package: Inclusion of social sharing and connect buttons on a shiny app or rmarkdown
Obinna N. Obianom
2024-01-10
Source:vignettes/introduction_r2social.Rmd
introduction_r2social.Rmd
The goal of this new R package is to provide functions that allow the inclusion of share and connect buttons on any page. This has been tested in Rmarkdown documents as well as on simply Shiny applications. See the examples folder of this package.
Constitutes the following features:
- [x] Share link buttons
- [x] Connect buttons
- [x] Hyperlink buttons
Installation and Library Attachment
The r2social package is available on CRAN and can be installed as shown below
install.packages(r2social)
Attach library
Use
The r2social can be used within the R Markdown document or in Shiny applications as shown below
Use in Shiny Application
library(shiny)
library(r2social)
ui <- fluidPage(
r2social.scripts(),
#include share buttons
shareButton(link = "http://rpkg.net", position = "left"),
shareButton(link = "http://obianom.com", position = "right"),
shareButton(link = "http://google.com", position = "inline"),
#include customized connect buttons where you specify direct links
connectButton(link = "http://rpkg.net", visit.us=TRUE, position = "inline"),
connectButton(link = "https://www.linkedin.com/in/oobianom", linkedin=TRUE, position = "inline"),
connectButton(link = "https://twitter.com/R2Rpkg", twitter=TRUE, position = "inline",display.inline = FALSE),
connectButton(link = "https://twitter.com/R2Rpkg", twitter=TRUE, position = "inline",display.inline = FALSE)
)
Use in Rmarkdown documents
library(r2social)
r2social.scripts()
# include share buttons
shareButton(link = "http://rpkg.net", position = "left")
shareButton(link = "http://obianom.com", position = "right")
shareButton(link = "https://shinyappstore.com/", position = "inline")
# include customized connect buttons where you specify direct links
connectButton(link = "http://rpkg.net", visit.us = TRUE, position = "inline")
connectButton(link = "https://www.linkedin.com/in/oobianom", linkedin = TRUE, position = "inline")
connectButton(link = "https://twitter.com/R2Rpkg", twitter = TRUE, position = "inline", display.inline = FALSE)
connectButton(link = "https://twitter.com/R2Rpkg", twitter = TRUE, position = "inline", display.inline = FALSE)