[R] adjusting "levels" after subset a table

Paulo Justiniano Ribeiro Jr paulojus at c3sl.ufpr.br
Sun Dec 9 04:52:18 CET 2007


running
my.df$my.var <- factor(my.df$my.var)

seems to do the job

P.J.

On Sat, 8 Dec 2007, Milton Cezar Ribeiro wrote:

> Dear all,
>
> I have a data.frame with a factor collumn with about 10 levels.
> After extract a subset of this data.frame, by selecting 2 of my 10 levels, the new data.frame continue with original number of levels. How can I adjust it in a manner that when I try levels(my.df) I receive the actualyzed number of levels?
>
> By the way, I read my file using reab.table.
>
> I tryed solve it with :  levels(my.df$my.var)<-unique(my.df$my.var) but the problem remain.
>
> Many thanks,
>
> miltinho
> Brazil
>
>
>
>  para armazenamento!
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
Paulo Justiniano Ribeiro Jr
LEG (Laboratorio de Estatistica e Geoinformacao)
Universidade Federal do Parana
Caixa Postal 19.081
CEP 81.531-990
Curitiba, PR  -  Brasil
Tel: (+55) 41 3361 3573
Fax: (+55) 41 3361 3141
e-mail: paulojus AT  ufpr  br
http://www.leg.ufpr.br/~paulojus

-------------------------------------------------------------------------
53a Reuniao Anual da Regiao Brasileira da Soc. Internacional de Biometria
14 a 16/05/2008, UFLA, Lavras,MG
http://www.centenario.ufla.br/



More information about the R-help mailing list