SHARE
TWEET

Untitled

a guest Mar 20th, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. form <- "a + b + c + d"
  2. t <- matrix(runif(20),nrow=10,ncol=2)
  3. colnames(t) <- c("col1","col2")
  4. form.new2 <- lapply(colnames(t),function(x) as.formula(paste(x,sep="~",form)))
  5. form.new2
  6.    
  7. [[1]]
  8. col1 ~ a + b + c + d
  9. <environment: 0x000000001c0809c8>
  10.  
  11. [[2]]
  12. col2 ~ a + b + c + d
  13. <environment: 0x000000001c07d350>
RAW Paste Data
Top