Re: [R] How do I Convert "<1" to the number 1?

2008-09-24 Thread John Fox
Dear Tom, I don't know whether it qualifies as elegant or clever, but you should be able to use sub(), as in > as.numeric(sub("<", "", c("1", "< -2", "<1"))) [1] 1 -2 1 I hope this helps, John On Wed, 24 Sep 2008 08:08:21 -0700 (PDT) Tom La Bone <[EMAIL PROTECTED]> wrote: > > Is there an e

[R] How do I Convert "<1" to the number 1?

2008-09-24 Thread Tom La Bone
Is there an elegant way in R to change a number reported as a less-than number in text format, "<1" for example, to the numeric equivalent 1? I have been trying to use as.numeric, but have not come up with anything clever yet. Tom -- View this message in context: http://www.nabble.com/How-do-