Certainly correct, but see also ?reorder.default
Cheers,
Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
"Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom."
H. Gilbert Welch
On Mon, Mar 3, 2014 at 9:55 AM, arun <smartpink111@yahoo.com> wrote:
> Hi,
> Check if the condition is similar to below:
> set.seed(28)
>
> vec1 <-
>
factor(sample(LETTERS[1:5],20,replace=TRUE),levels=c("B","C","D","A"))
> levels(vec1)
> #[1] "B" "C" "D" "A"
> summary(vec1)
> # B C D A NA's
> # 2 4 5 4 5
>
>
> A.K.
>
>
>
>
> Hi,
>
> I am trying to reorder a set of football team names from
> Alphabetical order to the positions they finished last season, therefore
> using the best team as a reference point in my final model.
>
> When using the
> football$Attack<-factor(football$Attack, levels=c("Manchester
> United","Manchester
Ciity","Chelsea","Arsenal",................")
>
> levels(football$Attack)
>
> showed the teams in the right order, however when I did a summary of the
> data it returned a lot of "NA"
>
>
> any idea how is best to succesfully reorder my data
>
> Thanks
>
> Stephen
>
> ______________________________________________
> 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.
>
[[alternative HTML version deleted]]