Skip to content

Instantly share code, notes, and snippets.

View lilywang1988's full-sized avatar
🙃
Never stop learning and creating

Lili Wang lilywang1988

🙃
Never stop learning and creating
View GitHub Profile
@lilywang1988
lilywang1988 / screen_toknow.md
Last active September 17, 2021 06:58
Commonly used screen commands in linux for a data scientist (who is not a linux expert)
  1. Install screen
sudo apt-get update
sudo apt-get install screen
  1. Check the version
screen --version
@lilywang1988
lilywang1988 / Ubuntu_prep.md
Last active August 1, 2021 23:44
Install Rstudio and the dependencies for eSIR on Ubuntu 20.04.2

Install R, devtools, jags, rjags, eSIR , rstan, and Rstudio on Ubuntu 20.04.2

To install R, follow this to install R.

Follow this to install devtools.

Install jags and then rjags following

sudo apt-get install JAGS
@lilywang1988
lilywang1988 / README.md
Created August 13, 2019 01:47 — forked from hofmannsven/README.md
Git Cheatsheet
@lilywang1988
lilywang1988 / README-Template.md
Created March 2, 2019 04:18 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@lilywang1988
lilywang1988 / Head_start_examples.R
Last active May 30, 2018 20:49
Example for multiple plots in ggplot
# Multiple plot function
#
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
# - cols: Number of columns in layout
# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
#
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
# then plot 1 will go in the upper left, 2 will go in the upper right, and
# 3 will go all the way across the bottom.
#
@lilywang1988
lilywang1988 / remv_legends.md
Last active May 28, 2018 00:20
Remove legends in ggplot

from r cookbook, where bp is your ggplot:

Remove legend for a particular aesthetic (fill):

bp + guides(fill=FALSE) It can also be done when specifying the scale:

bp + scale_fill_discrete(guide=FALSE) This removes all legends:

Example 1

rm(list=ls())
setwd("/Users/liliwang/Box/Cusum_simulation/restart3/For_paper/results/head_starts")
#date="20180311"
rho_list=seq(0,0.95,0.05)
mu_list=c(log(3),log(2),log(1.5),log(1.2),log(1),log(1),-log(1.2),-log(1.5),-log(2),-log(3)) #1-10
mu_list_str=c(paste0("log",c(3,2,1.5,1.2,1)),paste0("-log",c(1,1.2,1.5,2,3)))

data=NULL
@lilywang1988
lilywang1988 / List_in_Rcpp.md
Last active May 27, 2018 15:18
How to creat List in Rcpp

How to create List in Rcpp? 3 Ways!

1. Create the List directly and define the components

List res;
  res["beta1_scr"] = beta1_scr;
  res["beta2_scr"] = beta2_scr;
  res["beta1_inf"] = beta1_inf;
  res["beta2_inf"] = beta2_inf;
 res["r_scr"] = r_scr;
@lilywang1988
lilywang1988 / UltimateMarkdown.md
Last active May 23, 2018 15:12
Mark down notes

Link

A brief introduction about Markdown (notes)

Headings

Heading 1

Heading 2

Heading 3

Texts

italic

@lilywang1988
lilywang1988 / LaTeX_figures_side_by_side.md
Last active May 23, 2018 15:17
This is to introduce how to plot figures in Latex side by side

link

For two independent side-by-side figures, you can use two minipages inside a figure enviroment; for two subfigures, I would recommend the subcaption package with its subfigure environment; here's an example showing both approaches:

\documentclass{article}
  \usepackage[demo]{graphicx}
  \usepackage{caption}
  \usepackage{subcaption}