[R] make a column from the row names
John Kane
jrkrideau at yahoo.ca
Tue May 4 15:44:44 CEST 2010
Have a look at ?substring
--- On Tue, 5/4/10, Mohan L <l.mohanphy at gmail.com> wrote:
> From: Mohan L <l.mohanphy at gmail.com>
> Subject: [R] make a column from the row names
> To: r-help at r-project.org
> Received: Tuesday, May 4, 2010, 9:06 AM
> Dear All,
>
> > avglog
> 01/11/09 02/11/09 03/11/09 04/11/09
> 9.750000 4.500000 4.500000 8.666667
> > avglog1 <- data.frame(avglog)
> > avglog1
> avglog
> 01/11/09 9.750000
> 02/11/09 4.500000
> 03/11/09 4.500000
> 04/11/09 8.666667
>
> The first column isnt a column, It's the row names. I
> makeing a column from
> the row names by using the following
>
> > value1$Day <- rownames(value1)
> > value1
> avglog
> Day
> 01/11/09 9.750000 01/11/09
> 02/11/09 4.500000 02/11/09
> 03/11/09 4.500000 03/11/09
> 04/11/09 8.666667 04/11/09
>
> But I want like this :
>
> Day avglog
> Index
> 1 1 9.750000
> 9.750000*100
> 2 2 4.500000
> 4.500000*100
> 3 3 4.500000
> 4.500000*100
> 4 4 8.666667
> 8.666667*100
>
>
> How to achieve it? Any help will be appreciated.
>
> Thanks & Rg
> Mohan L
>
> [[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.
>
More information about the R-help
mailing list