Author: Obinna N. Obianom (pseudonym: William Hane)
Date: 2024-07-29

# r2social R package: Seamlessly include social sharing and connect buttons on a shiny app or rmarkdown

#### Obinna N. Obianom (pseudonym: William Hane)

#### 2024-07-29

## 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:

- profile cards with links

- Share link buttons alone

- Connect buttons alone

- Hyperlink buttons alone

### Installation and Library Attachment

The r2social package is available on CRAN and can be installed as shown below

`install.packages(r2social)`

Attach library

`library(r2social)`

### Use

The r2social can be used within the R Markdown document or in Shiny applications as shown below

#### Include the scripts and stylesheets for Rmarkdown

`r2social.scripts()`

## Feature 2: Profile card with social links

### Shiny application

    ui <- fluidPage(

    profileDisplay1(list(
      a = list(
        name = "Obi Obianom",
        title = "Senior Scientist",
        image = "https://r2social.obi.obianom.com/misc/team3.jpg",
        social = list(
          list(name = "x",
               link = "https://x.com/R2Rpkg"),
          list(name = "linkedin",
               link = "https://linkedin.com/oobianom"),
          list(name = "website",
               link = "https://obianom.com"),
          list(name = "youtube",
               link = "https://youtube.com/R2Rpkg")
        )
      ),
      b = list(
        name = "William Hane",
        title = "Core Developer",
        image = "https://r2social.obi.obianom.com/misc/team1.jpg",
        social = list(list(name = "youtube",
                           link = "https://youtube.com/R2Rpkg"))
      )
    ))

    )

### Rmarkdown application

    profileDisplay1(list(
      a = list(
        name = "Obi Obianom",
        title = "Senior Scientist",
        image = "https://r2social.obi.obianom.com/misc/team2.jpg",
        social = list(
          list(name = "x",
               link = "https://x.com/R2Rpkg"),
          list(name = "linkedin",
               link = "https://linkedin.com/oobianom"),
          list(name = "website",
               link = "https://obianom.com"),
          list(name = "youtube",
               link = "https://youtube.com/R2Rpkg")
        )
      ),
      b = list(
        name = "William Hane",
        title = "Core Developer",
        image = "https://r2social.obi.obianom.com/misc/team4.jpg",
        social = list(list(name = "youtube",
                           link = "https://youtube.com/R2Rpkg"))
      )
    ))

## Feature 1: Add social links on the sides

### Shiny application

    #ex 1 - to share various links
    ui <- fluidPage(
      r2social.scripts(),
      shareButton(link = "https://rpkg.net", position = "left"),
      shareButton(link = "https://shinyappstore.com", position = "inline"),
      shareButton(link = "https://shinyappstore.com", plain = T, position = "inline"), #plain style
      shareButton(link = "https://obianom.com", position = "right")
    )

    #ex 2 - to link your page to specific domain online
    ui <- fluidPage(
      r2social.scripts(),
      # to my personal website
      connectButton(link = "https://obianom.com", position = "inline",link.out = FALSE, visit.us = TRUE),

      # to my Twitter/X page
      connectButton(link = "https://x.com/R2Rpkg", position = "inline",link.out = FALSE, x = TRUE)
    )

### Rmarkdown document

    library(r2social)

    r2social.scripts()
    shareButton(link = "https://rpkg.net", position = "left")
    shareButton(link = "https://shinyappstore.com", position = "inline")
    shareButton(link = "https://obianom.com", position = "right")

## Full examples and documentation

- https://r2social.obi.obianom.com