Skip to content

How do I Convert "<1" to the number 1?

2 messages · Tom La Bone, John Fox

#
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
#
Dear Tom,

I don't know whether it qualifies as elegant or clever, but you should
be able to use sub(), as in
[1]  1 -2  1

I hope this helps,
 John

On Wed, 24 Sep 2008 08:08:21 -0700 (PDT)
Tom La Bone <booboo at gforcecable.com> wrote:
http://www.nabble.com/How-do-I-Convert-%22%3C1%22-to-the-number-1--tp19651018p19651018.html
--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/