[R] negative number to positive number

Clint Bowman clint at ecy.wa.gov
Wed Apr 25 20:59:10 CEST 2007


?abs

Clint Bowman			INTERNET:	clint at ecy.wa.gov
Air Dispersion Modeler		INTERNET:	clint at math.utah.edu
Air Quality Program		VOICE:		(360) 407-6815
Department of Ecology		FAX:		(360) 407-7534

	USPS:  		PO Box 47600, Olympia, WA 98504-7600
	Parcels:	300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 25 Apr 2007 J.delasHeras at ed.ac.uk wrote:

> Quoting "H. Paul Benton" <hpbenton at scripps.edu>:
>
> > Hello all,
> >
> > I know this is a pretty easy question but I can't find it in S poetry or
> > R help.
> >
> > How can I make a negative number positive. Such as
> > -5 to be +5
> > I tried +(-5), but that didn't work.
> >
> > So no, I don't mean taking a -5^2 just to get a positive number.
> > This is in a function so it's not just -5 it's x. :)
> >
> > Thanks,
> >
> > Paul
>
> how about just multiplying it by -1??? :-)
>
> -5*(-1)
>
> Jose
>
> --
> Dr. Jose I. de las Heras                      Email: J.delasHeras at ed.ac.uk
> The Wellcome Trust Centre for Cell Biology    Phone: +44 (0)131 6513374
> Institute for Cell & Molecular Biology        Fax:   +44 (0)131 6507360
> Swann Building, Mayfield Road
> University of Edinburgh
> Edinburgh EH9 3JR
> UK
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list