Guest User

Untitled

a guest
Feb 21st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. myfun() <- function(rowdf) {
  2. //statements
  3.  
  4. if(rowdf$price > 1000){
  5. val = "high"
  6. } elseif(rowdf$num_floors > 3){
  7. val = "high"
  8. } else{
  9. val = "low"
  10. }
  11. return(val)
  12. }
  13.  
  14. //df has columns price and num_floors
  15. bld_vals = apply(df, 1, myfun)
Add Comment
Please, Sign In to add comment