Skip to content
Prev 263499 / 398502 Next

else problem

On Jun 23, 2011, at 10:59 AM, Kara Przeczek wrote:

            
If this line is executed at a console session it will fail because the  
interpreter does not keep a copy of the last condition. If you moved  
the closing curley-brace to just befor the 'else', you should get the  
behavior you expect (if your other code is correct):

Try instead:

if (length(dat2f$year)%%2==0) {
  md <-dat2f[, list(med_year = max(year[which(abs(tot_km3y -  
median(tot_km3y)) == min(abs(tot_km3y - median(tot_km3y)))) ]),  
med_TotQ = median(tot_km3y))]
} else {
  md <-dat2f[, list(med_year = year[which(tot_km3y ==  
median(tot_km3y))], med_TotQ = median(tot_km3y))]
  }
Try instead:

?"else"