Skip to content
Prev 310272 / 398503 Next

conditional coding question

On Nov 7, 2012, at 3:07 PM, haps wrote:

            
You are making an inappropriate double assignment. This assignment will shoot off your foot.  I believe that for loops return NULL, so even if your loop succeeded in making all the assignments inside the body which it did not and I believe could not even with syntactic surgery for the reason expanded on below, the incorp value would be NULL afterward.
NULL
I doubt very much that you should be testing for (groupinc[i] == -3:-2)

I suspect you what to be testing whether groupinc[i] is in the range -3 to -2

For that you have a couple of choices. If you know for a fact that groupinc[i] will be integer valued (and is not really a double/float value then you could do:

if ( groupinc[i[ %in% -3:-2 )

If group inc[i] is a floating point number you should test:

if( groupinc[i] >= -3 & groupinc[i] <= -2)
That is a syntactic error, but I suspect you have semantic errors as mentioned above.
David Winsemius, MD
Alameda, CA, USA