Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. x<-c('A','B','C')
  2. data<-expand.grid(x,x)
  3. data$value<-c(1,2,3,2,1,4,3,4,1)
  4. r.data<-reshape(data, idvar = "Var1", timevar = "Var2", direction = "wide")
  5. colnames(r.data)<-c('Var','A','B','C')
  6. rownames(r.data)<-r.data$Var
  7. r.data$Var<-NULL
  8.  
  9. get_lower_tri<-function(cormat){
  10. cormat[upper.tri(cormat)] <- NA
  11. return(cormat)
  12. }
  13. r.data_lower<-get_lower_tri(r.data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement