[R] get the sign of a value

Sarah Goslee sarah.goslee at gmail.com
Thu Mar 14 20:48:01 CET 2013


You might perhaps look at:
?sign


On Thu, Mar 14, 2013 at 3:41 PM, Dimitri Liakhovitski
<dimitri.liakhovitski at gmail.com> wrote:
> Hello! Can't figure it out - hope it's simple:
>
> # I have some value (can be anything), e.g.:
> x = 12
> # I'd like it to become 1.
>
> # If the value is negative (again, it can be anything), e.g.:
> y = -12
> # I'd like it to become -1.
>
> How could I do it?
> Thanks a lot!
>
> --
> Dimitri Liakhovitski
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list