Skip to content

Instantly share code, notes, and snippets.

View mosesotieno's full-sized avatar
💻

Moses Otieno mosesotieno

💻
View GitHub Profile
@ddsjoberg
ddsjoberg / multinom_pivot_wider.R
Created May 11, 2021 12:14
function to display multinomial regression models in wide format
set.seed(20210511)
library(gtsummary)
library(magrittr)
multinom_pivot_wider <- function(x) {
# check inputs match expectatations
if (!inherits(x, "tbl_regression") || !inherits(x$model_obj, "multinom")) {
stop("`x=` must be class 'tbl_regression' summary of a `nnet::multinom()` model.")
}
@MichelleDalalJian
MichelleDalalJian / py4e_ex_11
Created October 7, 2017 14:48
Extracting Data With Regular Expressions Finding Numbers in a Haystack In this assignment you will read through and parse a file with text and numbers. You will extract all the numbers in the file and compute the sum of the numbers. Data Files We provide two files for this assignment. One is a sample file where we give you the sum for your testi…
import re
hand = open("regex_sum_24962.txt")
x=list()
for line in hand:
y = re.findall('[0-9]+',line)
x = x+y
sum=0
for z in x:
@barbolani
barbolani / clean-names
Created February 18, 2015 18:45
Bash script to clean up file names
#!/bin/bash
#
# Often multimedia files downloaded from the internet contain
# as part of the filename things like the site from where they came
# the local language of the audio and such info that is not useful
# when you archive the file to your multimedia repository.
#
# This script renames a set of files, removing everything that does
# not look like part of the file name
#