RE: [R] Take a levels

From: Eric Lecoutre <lecoutre_at_stat.ucl.ac.be>
Date: Wed 27 Apr 2005 - 22:34:44 EST

Well... did you look at the help page on factors??? Did you even make a search?
The answer is within your question:

> levels(iris[,5])

[1] "setosa" "versicolor" "virginica"

Eric

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of
> Muhammad Subianto
> Sent: mercredi 27 avril 2005 14:22
> To: R-help@stat.math.ethz.ch
> Subject: [R] Take a levels
>
>
> Dear all,
> How can I take a levels from a dataset.
> For example,
>
> data(iris)
> x.iris <- iris[,1:4]
> y.iris <- iris[,5]
> > y.iris
> [1] setosa setosa setosa setosa setosa setosa
> [7] setosa setosa setosa setosa setosa setosa
> ....
> [139] virginica virginica virginica virginica virginica
> virginica [145] virginica virginica virginica virginica
> virginica virginica
> Levels: setosa versicolor virginica
>
> I want like,
> y.iris level are,
> [] setosa versicolor virginica
>
> Best regards,
> Muhammad Subianto
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Apr 27 22:49:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:27 EST