[R] problem with max in a function

David Winsemius dwinsemius at comcast.net
Wed Sep 8 03:28:34 CEST 2010


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 numbers,  I will provide more information and code if it would
> make more sense in context.
>
> --  
> Stephen Sefick
> ____________________________________
> | Auburn University                                   |
> | Department of Biological Sciences           |
> | 331 Funchess Hall                                  |
> | Auburn, Alabama                                   |
> | 36849                                                    |
> |___________________________________|
> | sas0025 at auburn.edu                             |
> | http://www.auburn.edu/~sas0025             |
> |___________________________________|
>
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods.  We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
>                                 -K. Mullis
>
> "A big computer, a complex algorithm and a long time does not equal  
> science."
>
>                               -Robert Gentleman
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list