search for: glf9

Displaying 2 results from an estimated 2 matches for "glf9".

Did you mean: glf
2009 Mar 13
2
Taking diff of character vectors
...f I have nm2 <- c(rep("SPZ8", 10), rep("SPX9", 10)) how can I produce the same ouput as diff(nm1) does, that is zeros everywhere except for one place where SPZ8 changes to SPX9 (there should be 1 there)? What if I have a matrix of characters like that: nm3 <- c(rep("GLF9", 4), rep("GLF10", 16)) matr <- cbind(nm2, nm3) How can I efficiently create two more columns that contain zeros everywhere except for place where there is shift in character values? Thanks for help! Sergey -- I'm not young enough to know everything. /Oscar Wilde Experienc...
2009 Mar 14
1
multiple hypothesis testing
...apply and run > > over the columns and then cbind it back with the original dataframe. > > A) > > nm2 <- c(rep("SPZ8", 10), rep("SPX9", 10)) > > -1.0*c(0,as.numeric((head(nm2,-1) != tail(nm2,-1)))) > > > > B) > > nm3 <- c(rep("GLF9", 4), rep("GLF10", 16)) > > matr <- cbind(nm2, nm3) > > temp<-as.data.frame(sapply(1:ncol(matr), function(.col) { > > -1.0*c(0,as.numeric((head(matr[,.col],-1) != tail(matr[,.col],-1)))) > > })) > > cbind(matr,temp) > > > > > > &g...