Skip to content

Instantly share code, notes, and snippets.

@axjack
Created April 18, 2018 13:50
Show Gist options
  • Save axjack/c01e992a5ff72c8ff9c5963ae9fb8396 to your computer and use it in GitHub Desktop.
Save axjack/c01e992a5ff72c8ff9c5963ae9fb8396 to your computer and use it in GitHub Desktop.
R study
org_list <- c('g1','g2','g3','g4','g5','g6','g7','g8','g9')
org_list <- as.factor(org_list)
org <- sample(org_list, 1000, T)
a <- sample(0:10,1000,T)
b <- sample(0:10,1000,T)
c <- sample(0:10,1000,T)
d <- sample(0:10,1000,T)
k <- sample(0:3,1000,T)
df <- data.frame(org,a,b,c,d,k)
summary(df[2:6])
subset(df,org == 'g1' & a == 0)
head(df[c(3,2,1)], 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment