Skip to content
Prev 353647 / 398503 Next

cut variable within a loop

On Aug 14, 2015, at 6:40 AM, Janka Vanschoenwinkel wrote:

            
When using a function in R you may need to supply an argument name. Are you expecting this to be the number of groups. I cannot decipher the intent here with such sparse commentary, but this call to `cut2` does not make sense to me. Perhaps you meant the number of groups? .... in which case you need  cut2( Alldata$irrigation, g=i ), since the arguments to cut2 are not that same as the arguments to cut.

At the moment you are implicitly sending on the first pass a 1 and then on the second pass a 2 to the second argument of cut2 which is the `breaks` argument. So you wold be getting two different factors each with different cut-point levels. I looked at your data and in point of fact there would be no difference since you have 29 zero values and no values between 0 and 1.
0 [  1,100] 
       29        21
0 [  2,100] 
       29        21
David Winsemius
Alameda, CA, USA