This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, os | |
regex = "```\{r (.+)\}" | |
def name_chunks(f): | |
""" | |
This function takes a quarto (.qmd) file, checks for rmarkdown-style | |
labels, and converts to quarto-style labels. If a quarto-style label | |
exists, it preserves it (it checks the first line of the chunk metadata). | |
If no label exists, it creates one based on the file name, in sequential order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import tarfile | |
with tarfile.open('data.tar','w') as tar: | |
for name in Path('.').glob('*/filtered_feature_bc_matrix.h5'): | |
tar.add(name) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax on | |
filetype plugin indent on | |
set number | |
set path+=** | |
set noswapfile | |
set undofile | |
set incsearch | |
set smartindent | |
set ic | |
set expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def df_diff(d1, d2): | |
""" | |
df_diff Create a DataFrame containing rows of d1 not in d2 | |
Arguments: | |
d1 -- A data frame | |
d2 -- Another DataFrame which is a subset of d1 | |
Returns: | |
A pandas DataFrame containing rows of d1 that are not in d2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For a description of this file, please see: | |
# https://www.innoq.com/en/blog/markdown-with-zotero-workflow | |
#------------------------------------------------------------ | |
# what's the name of the generated output file(s) | |
OUTPUT=out | |
# what's the name of the markdown source file | |
SOURCE=principles-content.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
creation date: <% tp.file.creation_date() %> | |
tags: DailyNote <% tp.file.title.split('-')[0] %> | |
--- | |
modification date: <%+ tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm:ss") %> // This doesn't currently work in front matter, hoping that gets fixed. | |
# <% tp.file.title %> | |
<< [[<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>]] | [[<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>]]>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Example dashboard" | |
output: | |
flexdashboard::flex_dashboard: | |
orientation: columns | |
vertical_layout: scroll | |
html_document: default | |
--- | |
```{r setup, include=FALSE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remotes::install_github('ramikrispin/coronavirus') | |
library(coronavirus) | |
update_datasets() | |
pacman::p_load(char=c('tidyverse','janitor', 'ggrepel')) | |
deaths <- coronavirus %>% | |
clean_names() %>% | |
filter(type=='death') %>% | |
group_by(country_region, date) %>% | |
summarise(cases = sum(cases)) %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/25191620/ | |
# creating-lowpass-filter-in-scipy-understanding-methods-and-units | |
import numpy as np | |
from scipy.signal import butter, lfilter, freqz | |
from matplotlib import pyplot as plt | |
def butter_lowpass(cutoff, fs, order=5): | |
nyq = 0.5 * fs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' --- | |
#' title: An annotated R script for Homework 6 using lists and maps | |
#' output: html_document | |
#' --- | |
#' | |
#+, include=FALSE | |
knitr::opts_chunk$set(error=F, warning=F, message=F) | |
#' First, read the data in. We've stored just the data files in the folder `data/HW6`. | |
library(tidyverse) |
NewerOlder