Skip to content

Instantly share code, notes, and snippets.

@tbobin
tbobin / MsgReadSaveAttachment.R
Last active November 28, 2018 07:29
How to extract attachments with msgxtractr from outlook .msg files
library(tidyverse)
library(msgxtractr)
library(lubridate)
myReadSave_attachments <- function(msgFile){
# read the msg file
msg <- read_msg(msgFile)
breast %>%
ggplot(aes(x = ER, y =time_survival, fill= factor(event_survival))) +
geom_dotplot(binaxis = "y", stackdir = "center", dotsize = 0.6) +
theme(legend.position = "top") +
scale_fill_discrete(name = "Censored", label = c("yes","no")) +
coord_flip()
@tbobin
tbobin / repeatingPart.R
Last active January 21, 2018 18:44
rolling count repeating 1 in column
library(tidyverse)
dates <- c("2017-10-30",
"2017-11-06",
"2017-11-14",
"2017-11-20",
"2017-11-27",
"2017-12-04",
"2017-12-11",
@tbobin
tbobin / storedProcedures.R
Last active May 4, 2021 16:11
Execute stored procedures from R with odbc and DBI
library(tidyverse)
library(DBI)
library(odbc)
# connect to database
cn <- dbConnect(odbc::odbc(), driver = "ODBC Driver 13 for SQL Server",
server="MYSQLSERVER\\SQLEXPRESS",
database = "myTestDB",
Trusted_Connection="Yes")
library(tidyverse)
library(rvest)
url_base <- "http://www.presseportal.de/blaulicht/d/polizei/"
content <- read_html(url_base)
css <- ".pad-b-l .news"
@tbobin
tbobin / outliers.R
Created April 27, 2017 11:18
example how to handel outliers in a dataset by seting outliers to the 5% re 95% quantile
#quick and dirty
library(tidyverse)
# some data
x <- c(12,8,80,56,round(runif(100,1000,1050)),1100,1150,1222,1180,1200,1190)
hist_data <- data.frame(x)
---
title: "Test dynamic gauge generation"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
@tbobin
tbobin / server.R
Created October 9, 2016 17:46 — forked from withr/server.R
Encrypt password with md5 for Shiny-app.
library(shiny)
library(datasets)
Logged = FALSE;
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad")
# Define server logic required to summarize and view the selected dataset
shinyServer(function(input, output) {
source("www/Login.R", local = TRUE)
observe({
if (USER$Logged == TRUE) {