Re: [R] problem with max in a function

2010-09-07 Thread Nikhil Kaza
Comments below On Sep 7, 2010, at 9:37 PM, stephen sefick wrote: Here is a striped down example that is not working because of the 1.00 to 1. Any help would be greatly appreciated. measure_bkf <- (structure(list(measurment_num = c(0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.2, 2.4

Re: [R] problem with max in a function

2010-09-07 Thread David Winsemius
On Sep 7, 2010, at 10:05 PM, stephen sefick wrote: I'm sorry. In the bkf_max <- grep(max(measure_bkf_not_zero[,"bankfull_depths_m"]), measure_bkf_not_zero[,"bankfull_depths_m"]) it is giving the indexes for 1 5 10 15 16 And it was supposed to yield ... what? I think this is because grep

Re: [R] problem with max in a function

2010-09-07 Thread stephen sefick
I'm sorry. In the bkf_max <- grep(max(measure_bkf_not_zero[,"bankfull_depths_m"]), measure_bkf_not_zero[,"bankfull_depths_m"]) it is giving the indexes for 1 5 10 15 16 I think this is because grep encounters a 1 with either 0. or nothing in front of it. I would like to find the max and then t

Re: [R] problem with max in a function

2010-09-07 Thread David Winsemius
On Sep 7, 2010, at 9:37 PM, stephen sefick wrote: Here is a striped down example that is not working That dreadful phrase... "is not working". When the ESP package comes to fruition, life will be so easy. Until then ... the English language is necessary. Where am we supposed to be looking

Re: [R] problem with max in a function

2010-09-07 Thread stephen sefick
Here is a striped down example that is not working because of the 1.00 to 1. Any help would be greatly appreciated. measure_bkf <- (structure(list(measurment_num = c(0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.2, 2.4, 2.6, 2.8), bankfull_depths_m = c(-0.15, -0.09, -0.00998

Re: [R] problem with max in a function

2010-09-07 Thread David Winsemius
On Sep 7, 2010, at 9:06 PM, stephen sefick wrote: s <- 1.00 max(s) > sprintf("%.2f", max(s)) [1] "1.00" @ as a string/character object returns 1 is there anyway that I can get it to return 1.00. I am using the results of this max statement in a grep statement and it returns the wrong

[R] problem with max in a function

2010-09-07 Thread stephen sefick
s <- 1.00 max(s) returns 1 is there anyway that I can get it to return 1.00. I am using the results of this max statement in a grep statement and it returns the wrong numbers, I will provide more information and code if it would make more sense in context. -- Stephen Sefick __