k10dayogi

Tagged Expressions in R.

Nov 14th, 2016
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.52 KB | None | 0 0
  1. # Lines to fix semester notation so it is consistent and split up manual dates.
  2. x<-vector("character",1);y<-list()
  3. x[1]<-"O ends SS18; W ends SS20"
  4. x<-gsub("SS([0-9][0-9])","Summer 20\\1",x)
  5. f <- function(s) strsplit(s, ";")
  6. y<-sapply(x, f) # Find the split up strings by doing y[[1]][1] or y[[1]][2] etc.
  7. # Lines to put manually entered dates into the correct "bin."
  8. w<-list();eth<-w;o<-w;h<-w
  9. for(i in 1:length(x)){
  10.     w[[i]]<-grep("W",y[[i]]);eth[[i]]<-grep("E",y[[i]]);o[[i]]<-grep("O",y[[i]]);h[[i]]<-grep("H",y[[i]])
  11. }
Advertisement
Add Comment
Please, Sign In to add comment