Skip to content
Back to formatted view

Raw Message

Message-ID: <50752AD0.5080709@sapo.pt>
Date: 2012-10-10T07:59:12Z
From: Rui Barradas
Subject: Data Frame processing.
In-Reply-To: <1349854900944-4645664.post@n4.nabble.com>

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.