[R] convert data frame values

From: Adrian Johnson <oriolebaltimore_at_gmail.com>
Date: Thu, 03 Apr 2008 17:57:35 -0400

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


        [[alternative HTML version deleted]]

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. Received on Thu 03 Apr 2008 - 22:02:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Apr 2008 - 23:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive