[R] Wondering why I get a NULL output for this if condition!

Boris Steipe boris.steipe at utoronto.ca
Fri Nov 21 20:06:43 CET 2014


Seems to me you probably wanted a "while" in line 4.

N.b.  There's also a missing "}" and totally messed up formatting :-(

B.

 
On Nov 21, 2014, at 1:19 PM, Aditya Singh <aps6dl at yahoo.com> wrote:

> 1 my_min= min(outcome_data[which(outcome_data$State==my_state),11],na.rm=TRUE) 
> 2 print(my_min) 
> 3 jkr=0 
> 4 if (jkr<= 4706) {jkr=jkr+1 
> 5 if (identical(outcome_data[jkr,11],my_min) && identical(outcome_data[jkr,7],my_state)) { 
> 6 print((outcome_data[jkr,2])) 
> 7 break 
> 8 } 
> 
> 
> Dear Experts,
> 
> My computer is never 'inside' of  the if condition at line 5, as jkr=0 always. my_min is a numeric. my_state is a 2 letter American State (character).
> 
> This code gives NULL as output. Wondering!
> 
> Its either very obvious or I am very dumb.
> 
> Please do do reply!
> 
> Aditya
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list