[R] transforming factor back to numbers
Rainer M Krug
rkrug at sun.ac.za
Thu Sep 21 11:55:11 CEST 2006
Hi
I generate a new dataframe by doing:
npl.agg <- aggregate(npl$DensPlants, list(year=npl$year, sim=npl$sim),
mean, na.rm=TRUE )
Now I want to plot it by using
coplot(npl.agg$x ~ npl.agg$year | npl.agg$sim, type="l")
but, as npl.agg$year is seen as a factor, the order of the points on the
x-axis (time axis) does not follow the numerical sorting 1...100, but
rather the text sorting of the factor npl.agg$year
Is there any way that I can 'defactor' npl.agg$year so that I have again
the numerical values for year?
Thanks
Rainer
--
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)
Department of Conservation Ecology and Entomology
University of Stellenbosch
Matieland 7602
South Africa
Tel: +27 - (0)72 808 2975 (w)
Fax: +27 - (0)21 808 3304
Cell: +27 - (0)83 9479 042
email: RKrug at sun.ac.za
Rainer at krugs.de
More information about the R-help
mailing list