> And subsetting a factor retains the original factor levels. To drop
> unused levels, just use factor(f[index]) or f[index, drop=TRUE]. The
> opposite behaviour can be even more annoying/dangerous because it leads
> to empty cells dropping out of tables and bars disappearing from barplots.

Of course you can apply the same reasoning to continuous variables
too.  I've always thought it would be interesting to have a continuous
analogue of a factor that preserved its original range by default.

Hadley


-- 
http://had.co.nz/

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to