Skip to content

Instantly share code, notes, and snippets.

View AntoineSoetewey's full-sized avatar

Antoine Soetewey AntoineSoetewey

View GitHub Profile
# All packages used below must be installed first
library(devtools)
# devtools::install_github("laresbernardo/lares")
library(lares)
library(ggplot2)
today <- as.character(Sys.Date())
dat <- mtcars[, c(1, 3:7)]
corrplot2 <- function(data,
method = "pearson",
sig.level = 0.05,
order = "original",
diag = FALSE,
type = "upper",
tl.srt = 90,
number.font = 1,
@AntoineSoetewey
AntoineSoetewey / statistics-202.R
Last active December 26, 2022 09:00
Shiny app for simple linear regression by hand and in R. See more information at: https://antoinesoetewey.shinyapps.io/statistics-202/
library(shiny)
library(ggplot2)
library(plotly)
library(rmarkdown)
library(knitr)
library(pander)
set.seed(123)
n <- 100
# Define UI for application that draws a histogram
@AntoineSoetewey
AntoineSoetewey / how-to-embed-a-shiny-app-in-a-r-markdown-document.Rmd
Last active November 29, 2022 12:59
Code for the article How to embed a Shiny app in blogdown. See more information at: https://statsandr.com/blog/how-to-embed-a-shiny-app-in-blogdown/
---
title: How to embed a Shiny app in blogdown
author: Antoine Soetewey
date: '2020-01-07'
slug: how-to-embed-a-shiny-app-in-blogdown
categories: []
tags:
- Shiny
- Web
meta_img: blog/how-to-embed-a-shiny-app-in-a-r-markdown-document_files/shiny-app-in-blogdown.jpeg
@AntoineSoetewey
AntoineSoetewey / statistics-101.R
Last active January 7, 2022 14:34
Shiny app to compute probabilities for the main probability distributions. See more information at: https://antoinesoetewey.shinyapps.io/statistics-101/
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
@AntoineSoetewey
AntoineSoetewey / statistics-201.R
Last active January 7, 2022 14:34
Shiny app to perform statistical inference on mean(s), proportion(s) and variance(s). See more information at: https://antoinesoetewey.shinyapps.io/statistics-201/
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
@AntoineSoetewey
AntoineSoetewey / word-cloud.R
Last active January 7, 2022 14:33
Shiny app with an example of word cloud. See more information at: https://antoinesoetewey.shinyapps.io/word-cloud/
library(shiny)
# install.packages("wordcloud2")
library(wordcloud2)
# install.packages("tm")
library(tm)
# install.packages("colourpicker")
library(colourpicker)
ui <- fluidPage(
h1("Word Cloud"),
@AntoineSoetewey
AntoineSoetewey / optimal-asset-allocation.R
Last active January 7, 2022 14:33
Shiny app with an example of optimal asset allocation. See more information at: https://antoinesoetewey.shinyapps.io/optimal-asset-allocation/
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
t_table <- function(data, dvs, iv,
var_equal = TRUE,
p_adj = "none",
alpha = 0.05,
paired = FALSE,
wilcoxon = FALSE) {
if (!inherits(data, "data.frame")) {
stop("data must be a data.frame")
}
@AntoineSoetewey
AntoineSoetewey / stock_price_covid19.R
Last active January 7, 2022 14:30
Data manipulation in R to plot active covid19 cases and Apple stock price. See comment in https://statsandr.com/blog/data-manipulation-in-r/
# install.packages("quantmod")
library(quantmod)
# devtools::install_github("RamiKrispin/coronavirus", force = TRUE)
library(coronavirus)
# coronavirus dataset
`%>%` <- magrittr::`%>%`
df <- coronavirus %>%
# dplyr::filter(date == max(date)) %>%
dplyr::filter(country == "Indonesia") %>%