[R] Convert factor to numeric vector of labels
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sun Aug 12 12:58:08 CEST 2007
See the FAQ Q7.10 (and please study the posting guide)
On Sun, 12 Aug 2007, Falk Lieder wrote:
> Hi,
>
> I have imported a data file to R. Unfortunately R has interpreted some
> numeric variables as factors. Therefore I want to reconvert these to numeric
> vectors whose values are the factor levels' labels. I tried
> as.numeric(<factor>),
> but it returns a vector of factor levels (i.e. 1,2,3,...) instead of labels
> (i.e. 0.71, 1.34, 2.61,
).
> What can I do instead?
>
> Best wishes, Falk
>
> [[alternative HTML version deleted]]
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list