Re: [R] Help with assigning a value based on existing numbers

2010-03-28 Thread Petr PIKAL
ondon.edu | London experience. World impact. > -Original Message- > From: Petr PIKAL [mailto:petr.pi...@precheza.cz] > Sent: 26 March 2010 14:00 > To: Jessica Cathro > Cc: r-help@r-project.org > Subject: Odp: [R] Help with assigning a value based on existing numbe

Re: [R] Help with assigning a value based on existing numbers

2010-03-26 Thread sjaffe
An expression like "v >= 52", where v is a vector, will produce a vector resulting from comparing each entry -- that is why you see the message. What you want to do is logical subscripting. For example names <- character( nrow( curveData ) ) names[ curvedata$Date.difference <= 29 ] = "< 1 mon

[R] Help with assigning a value based on existing numbers

2010-03-26 Thread Jessica Cathro
Hi All I have a column/variable called time difference. It has a whole list of numbers from 0 through to the hundreds eg 236. I want to assign a corresponding "name" to each variable from a predefined list: Month or less, 1 -2 months, 2-3 months etc So the result would look something like: Tim