Re: [R] transforming factor back to numbers

2006-09-21 Thread Rainer M Krug
Thanks a lot David. Just a suggestion - it might help if this is added to the help of factor() Rainer David Barron wrote: > That's an FAQ: > > 7.10 How do I convert factors to numeric? > > It may happen that when reading numeric data into R (usually, when > reading in a file), they come in as

Re: [R] transforming factor back to numbers

2006-09-21 Thread David Barron
That's an FAQ: 7.10 How do I convert factors to numeric? It may happen that when reading numeric data into R (usually, when reading in a file), they come in as factors. If f is such a factor object, you can use as.numeric(as.character(f)) to get the numbers back. More efficient, but harder

[R] transforming factor back to numbers

2006-09-21 Thread Rainer M Krug
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