Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myfun() <- function(rowdf) {
- //statements
- if(rowdf$price > 1000){
- val = "high"
- } elseif(rowdf$num_floors > 3){
- val = "high"
- } else{
- val = "low"
- }
- return(val)
- }
- //df has columns price and num_floors
- bld_vals = apply(df, 1, myfun)
Add Comment
Please, Sign In to add comment