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 -- Research Technician Mass Spectrometry o The / o Scripps \ o Research / o Institute
On Tue, 2007-04-24 at 16:46 -0700, H. Paul Benton wrote:> 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. :)abs(x) ------------------------------------------------------------------- Rajarshi Guha <rguha at indiana.edu> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE ------------------------------------------------------------------- C Code. C Code Run. Run, Code, RUN! PLEASE!!!!
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, > > Paulhow 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