x <- as.data.frame( matrix( 0:255, nrow = 16 ) ) ifelse( x > 127.5, 1, -1 )
Is that what you want? Rgds, Rainer On Wednesday 21 November 2012 10:32:49 Brian Feeny wrote: > > I have a dataframe in which I have values 0-255, I wish to transpose them > such that: > > if value > 127.5 value = 1 > if value < 127.5 value = -1 > > I did something similar using the "binarize" function of the biclust package, > this transforms my dataframe to 0 and 1 values, but I wish > to use -1 and 1 and looking for a way in R to do this. > > Brian > > ______________________________________________ > 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. ______________________________________________ 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.