On Mon, Oct 20, 2008 at 03:07:45PM +0200, Kåre Edvardsen wrote: > I'd like to avoid looping through an array in order to change values in > the array as it takes too long. > I red from an earlier post it can be done by "do.call" but never got it > to work. The Idea is to change the value of "y" according to values in > "x". Wherever "x" holds the value 3, the corresponding value in "y" > should be set to 1.
This should do what you want - no looping required: y[x==3] <- 1 cu Philipp -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihenstephan 85350 Freising, Germany http://mips.gsf.de/staff/pagel ______________________________________________ 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.