Adrian If test[,2] is numeric then
test[,2] <- -test[,2] should be all you need. If it isn't numeric you'll need to convert it first; e.g., test[,2] <- -as.numeric(as.character(test[,2])) which can, of course, be converted back to the original class. HTH ....... Peter Alspach > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Adrian Johnson > Sent: Friday, 4 April 2008 10:58 a.m. > To: r-help > Subject: [R] convert data frame values > > Hello: > How can I interchange symbols for numeric values in a data frame. > > > test > f s t > 1 a 1 -1 > 2 b 1 -3 > 3 c -1 1 > > say I have test d.f . I want to make flip number that are > positive to negative and negative to positive only for > numerics in column 's' > > my desired result: > > > new.test > f s t > 1 a -1 -1 > 2 b -1 -3 > 3 c 1 1 > > > thanks > Adrian > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. ______________________________________________ R-help@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.