Skip to content

Instantly share code, notes, and snippets.

---
title: "Customer Service Survey EDA"
author: Brad Lindblad, MBA
output:
pdf_document:
number_sections: yes
toc: yes
html_notebook:
number_sections: yes
theme: journal
@mustafaascha
mustafaascha / format-pubmed.R
Created January 19, 2019 22:07
Format PubMed file exports
pubmed_cv <- function(fl_nm) {
library(tidyverse)
readLines("pubmed_result.txt") %>%
(function(z) z[z != ""]) %>%
(function(cv) {
grep("^[0-9]+?:", trimws(cv)) %>%
list(
beginnings = .,
@mustafaascha
mustafaascha / _Nvim-R-Tmux.md
Created December 22, 2018 18:46 — forked from tgirke/_Nvim-R-Tmux.md
Nvim-R-Tmux: An Integrated Working Environment for R
@mustafaascha
mustafaascha / disk_use.R
Created November 27, 2018 01:48
Get a tidy representation of disk usage
library(tidyverse)
rm_rownames <- function(z) {
rownames(z) <- NULL
z
}
sz_message <- function(sz, p_nm, ttl, bs) {
p_mn <- round(mean(sz[[p_nm]], na.rm = T))
#' Notes from Clinical Information Systems, October 2 2018
#'
# Contents ========================================
#'
#' From 2018
#' 1. Human immunodeficiency status versus white
#' blood cell counts, visualization and modeling
#' 2. Body mass index versus dietary habits (salt intake
#' and salmon consumption)
#' 3. Income and fast-food consumption
@mustafaascha
mustafaascha / Clinical-Info-Systems-2018-10-02
Last active October 9, 2018 13:48
Code and comments from a live coding exercise
#' Notes from Clinical Information Systems, October 2 2018
#'
# Contents ========================================
#'
#' From 2018
#' 1. Human immunodeficiency status versus white
#' blood cell counts, visualization and modeling
#' 2. Body mass index versus dietary habits (salt intake
#' and salmon consumption)
#'
#Notes from Clinical Information Systems, October 3 2017
# Contents ===================================================================
# 1. HPV frequencies, model
# 2. Vitamin D and depression
# Setup =====================================================================
09:27 ~: ssh -vv -i ./.ssh/dataincubator vagrant@XXX.XXX.XX.XXX
OpenSSH_7.5p1, OpenSSL 1.0.2l 25 May 2017
debug1: Reading configuration data /Users/mustafaascha/.ssh/config
debug1: Reading configuration data /usr/local/etc/ssh/ssh_config
debug2: resolving "XXX.XXX.XX.XXX" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to XXX.XXX.XX.XXX [XXX.XXX.XX.XXX] port 22.
debug1: Connection established.
debug1: identity file ./.ssh/dataincubator type 1
debug1: key_load_public: No such file or directory
@mustafaascha
mustafaascha / gustavo.R
Created March 21, 2017 14:40
Using 2290 as the x-axis limit
#’ Create a Kaplan-Meier plot using ggplot2
#’
#’ @param sfit a \code{\link[survival]{survfit}} object
#’ @param returns logical: if \code{TRUE}, return an ggplot object
#’ @param xlabs x-axis label
#’ @param ylabs y-axis label
#’ @param ystratalabs The strata labels. \code{Default = levels(summary(sfit)$strata)}
#’ @param ystrataname The legend name. Default = “Strata”
#’ @param timeby numeric: control the granularity along the time-axis
#’ @param main plot title
@mustafaascha
mustafaascha / random_networks.R
Created February 28, 2017 03:01
Make a bunch of networks whose links are a function of the binomial distribution
set.seed(12121212)
library(network)
nw_random <- function(prob, size_net) {
network(x = matrix(rbinom(size_net ^ 2, 1, prob = prob), ncol = size_net, nrow = size_net))
}
library(ggnetwork)