[R] Data Frame processing.

Rui Barradas ruipbarradas at sapo.pt
Wed Oct 10 09:59:12 CEST 2012


Hello,

Try the following.

rownames(df) <- seq_len(nrow(df))

Hope this helps,

Rui Barradas
Em 10-10-2012 08:41, CrimMagic escreveu:
> Hi Everyone! :D
>
> Just need a little help on data frames. I was wondering if anyone would know
> a way to rename the row numbers on a data frame.
>
> e.g.
>> head(df)
>                              Hats      Dogs     Horses
> 52             Glen    9.53       0.00          0.00
> 18             Jane     1.48      1.48           1.48
> 15             Lona    1.36      0.45           1.14
> 9               Hung   0.80      0.40           0.50
> 25             Artian  0.68      0.23           0.45
>
> Since i re-ordered my original df by decreasing Hats size, the row numbers
> are now out or order. Is there a code or something to re-number the new data
> frame?
>
> Thanks in advance for any help! :D
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Data-Frame-processing-tp4645664.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.




More information about the R-help mailing list