Skip to content

Instantly share code, notes, and snippets.

View mayank7jan's full-sized avatar

Mayank Agrawal mayank7jan

  • Gold Coast, Australia
View GitHub Profile
@yjunechoe
yjunechoe / rselenium-boxscroll.R
Created November 16, 2022 18:56
RSelenium script to simulate scrolling of a pop-up box to the end, using twitter app reviews on google play store as example
library(RSelenium)
# Google play store page for twitter app
url <- "https://play.google.com/store/apps/details?id=com.twitter.android"
# RSelenium firefox browser setup
driver <- rsDriver(browser = 'firefox', verbose = FALSE, port = 123L)
session <- driver$client
session$open()
@hypebright
hypebright / histoslider_demo.R
Created September 27, 2022 12:14
Demo of the histoslider package
# install histoslider
# remotes::install_github("cpsievert/histoslider")
# load libraries
library(shiny)
library(histoslider)
library(data.table)
library(quantmod) # to get current exchange rates
# load airbnb dataset containing properties in London
@gshotwell
gshotwell / gist:b19ef520b6d56f61a830fabb3454965b
Created September 26, 2022 16:01
Time series with breaks
library(tidyverse)
library(lubridate)
df <- tibble(
dist1 = sort(rnorm(100, 5, 2)),
dist2 = sort(rnorm(100, 8, 3)),
dist4 = sort(rnorm(100, 15, 1)),
date = seq.Date(from = ymd("2022-01-01"), ymd("2022-04-10"), by = "day")
)
@RamiKrispin
RamiKrispin / messages in R.R
Created September 16, 2022 14:14
Examples for printing messages during run time with R
# Print messages with print and cat
print("This is the message I want to print")
cat("This is the message I want to print\n") # Using the \n operator to jump for the next line
# The print command can also print code output
print(data.frame(x = 1:3, y = 4:6))
# Where cat cannot print non text or multiple vector objects
cat(data.frame(x = 1:3, y = 4:6))
@hypebright
hypebright / shiny_callR_demo.R
Last active January 23, 2024 11:15
Small demo to use background processes in Shiny apps with callR
library(shiny)
library(callr)
ui <- fluidPage(
titlePanel('Using callR in Shiny'),
actionButton('start_job', 'Start Expensive Job'),
tableOutput('result_table')
)
@kellobri
kellobri / app.R
Created May 14, 2021 00:33
Bookmarking & Commenting App Template
#
# Bookmarking
# Annotations & Commenting
# Gitlink
#
library(shiny)
library(gitlink)
# Define UI for application that draws a histogram
@matt-dray
matt-dray / badgr-shiny.R
Last active June 20, 2024 09:23
Make a shields.io README badge that links to a Shiny app, using the {badgr} package in R
# Make a README badge for your R Shiny repo
# Matt Dray, March 2021
# {badgr} blog post: https://www.rostrum.blog/2020/05/08/readme-badge/
# Shiny badge blog post: https://www.rostrum.blog/2021/03/23/shiny-badge/
# {badgr} is available from GitHub via {remotes}
install.packages("remotes") # if not already installed
remotes::install_github("matt-dray/badgr") # install {badgr}
@kellobri
kellobri / app.R
Created January 23, 2021 18:33
Shiny Application example: Bookmarkable and Commentable
#
# The basic multiple bookmark buttons example on Shiny Dev Center:
# https://shiny.rstudio.com/articles/bookmarking-state.html
#
library(shiny)
library(palmerpenguins)
library(ggplot2)
library(dplyr)
@kellobri
kellobri / inventory-alert.Rmd
Created January 2, 2020 16:13
Conditional Either/Or Example: Etsy Shop R Markdown Report with Blastula Custom Email
---
title: "Action Required: Low Inventory Alert!"
output: blastula::blastula_email
---
<img src="low-inventory-banner.png">
A low inventory alert has been triggered - Review the current inventory levels below to determine which filament colors need to be replenished today.
### Current inventory by unit color:
@kellobri
kellobri / etsy-shop-report.Rmd
Last active March 21, 2024 15:16
Conditional Suppression Example: Etsy Shop R Markdown Report with Blastula Custom Email
---
title: "Cookie Cutter Shop Report"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(blastula)
```