R

R严格意义不是OOP 所以list可以被用来做container

reg<- lm() 就能极其简单的regression,reg$就有所有hints 知道该用哪个parameter

dataframe也是一个list。

# matrix multiplication
%*%

#grep grepl
haystack <- c("red", "blue", "green", "blue", "green forest")


grep("green", haystack)

grep("r", haystack) # returns position
grep("r", haystack, value = TRUE) # returns value
grepl("r", haystack) # returns boolean

sub("e", "+", haystack) # replaces pattern with replacement (once)
gsub("e", "+", haystack) # replaces pattern with replacement (global)

Introduction to the Tidyverse (Notes)

Import data in R 1 (Notes)

Import data in R 1 (Notes)

Cleaning Data in R (Notes)

R里对于variable的定义

character、numeric(NaN和Inf都是numeric)、integer(以L结尾的才是integer)、factor、logical(NA算logical)

Network Science in R (Notes)

Predictive Analytics using Networked Data in R (notes)

Number of edges in a fully connected network (nodes2)=nodes(nodes 1)2\left(\begin{array}{c}{\text {nodes}} \\ {2}\end{array}\right)=\frac{\text {nodes}(\text {nodes }-1)}{2}

Network Connectance P p=2edgesnodes(nodes1)p=\frac{2 \cdot e d g e s}{n o d e s(n o d e s-1)} (ratio of the actual number of the edges/fully connected)

Expected Number of same label edges: (nq2)p=ng(ng1)2p\left(\begin{array}{c}{n q} \\ {2}\end{array}\right) \cdot p=\frac{n g(n g-1)}{2} \cdot p

Diadicity D= number of same label edges  expected number of same label edges D=\frac{\text { number of same label edges }}{\text { expected number of same label edges }} D>1 Dyadic D1 Random D<1 Anti-Dyadic \begin{array}{l}{D>1 \Rightarrow \text { Dyadic }} \\ {D \simeq 1 \Rightarrow \text { Random }} \\ {D<1 \Rightarrow \text { Anti-Dyadic }}\end{array}

Expected Number of cross label edges = nwngpn_{w} n_{g} p

Heterophilicty: H= number of cross label edges  expected number of cross label edges H=\frac{\text { number of cross label edges }}{\text { expected number of cross label edges }}

 1. H>1 Heterophilic  2. H1 Random  3. H<1 Heterophobic \begin{array}{l}{\text { 1. } H>1 \Rightarrow \text { Heterophilic }} \\ {\text { 2. } H \simeq 1 \Rightarrow \text { Random }} \\ {\text { 3. } H<1 \Rightarrow \text { Heterophobic }}\end{array}

Last updated