Try this: cut(sample(0:1000, 100), breaks = c(0, 300, 600, 900, 1000), labels = c('A', 'B', 'C', 'D'))
On Fri, Jul 31, 2009 at 4:04 PM, Mehdi Khan <mwk...@ucdavis.edu> wrote: > hello all, > > I have a data frame and I want to create a column which assigns a letter > based upon the value in another column. The data column has velocities > ranging from 0 to 1000. So for example, for velocities between 0 and 300 > I'd like to assign the letter "A" in the new column, for 300-600, "B" and > so > on and so forth. How would I do this? > > Thank you very much! > > Mehdi Khan > > [[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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[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.