Skip to content

Instantly share code, notes, and snippets.

View haozhu233's full-sized avatar
🧙

Hao Zhu haozhu233

🧙
View GitHub Profile
@haozhu233
haozhu233 / code_in_table.rmd
Created October 28, 2020 06:22
Test code in table.
---
title: "Untitled"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(message = FALSE)
```
## R Markdown
@haozhu233
haozhu233 / Graph Propagation Example.ipynb
Last active July 17, 2020 17:09
Graph Propagation Example. See slides at https://bit.ly/intro_to_gnn
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@haozhu233
haozhu233 / README.md
Last active November 12, 2019 15:57 — forked from michaelchughes/README.md
update version script

Goal

Install working tensorflow or pytorch via standard conda environment workflow.

Basic Setup : Install pytorch in a fresh conda environment

The recommended conda-based install process works smoothly:

$ # Create a fresh environment
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@haozhu233
haozhu233 / write_fwf.R
Last active May 17, 2024 09:41
Generate fixed width file in R
#' Generate fixed width file in R
#' @description This simple function creates fixed width file with no
#' extra dependencies.
#' @param justify "l", "r" or something like "lrl" for left, right, left.
#' @examples dt <- data.frame(a = 1:3, b = NA, c = c('a', 'b', 'c'))
#' write_fwf(dt, "test.txt", width = c(4, 4, 3))
#' @export
write_fwf = function(dt, file, width,
justify = "l", replace_na = "NA") {
fct_col = which(sapply(dt, is.factor))
@haozhu233
haozhu233 / demo.Rmd
Created July 10, 2019 04:56
linebreak + %
---
title: "Untitled"
author: "Hao"
date: "7/10/2019"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@haozhu233
haozhu233 / bs-table.css
Created May 10, 2019 20:11
bootstrap 3 table part
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (<none>)
* Config saved to config.json and <none>
@haozhu233
haozhu233 / grouped_forest.R
Last active September 27, 2018 19:45
forest plot with grouping need
library(broom)
library(tidyverse)
library(viridis)
fit <- lm(mpg ~ ., data = mtcars)
fit_dt <- tidy(fit, conf.int = T)
# reverse the order so it looks right on plot
library(shiny)
library(imager)
library(colocr)
# Define UI for application that draws a histogram
ui <- navbarPage(
title = 'colocr',
tabPanel(
'Main',
sidebarLayout(
@haozhu233
haozhu233 / demo.Rmd
Created November 10, 2017 21:39
2 tables in the same row
---
output: html_document
---
```{r}
library(tidyverse)
library(kableExtra)
library(knitr)
a <- mpg %>%