[R] Formatting data, adding column names, use reshape, a newbie question

hadley wickham h.wickham at gmail.com
Mon Apr 19 17:15:57 CEST 2010


On Mon, Apr 19, 2010 at 5:13 AM, Paul Rigor (ucla) <pryce at ucla.edu> wrote:
> Hi all,
> I'm an R novice.
>
> I have data that's already formatted as "molten" that reshape should be able
> to work with. For example, the following was read in with
> read.csv(filename,sep=" ", header=FALSE)
>
>      V1               V2         V3                 V4
>  V5
> 1    original    book    book.source1.txt    328900494    3039.525
> 2    original    book    book.source1.txt    328900494    3057.952
>
>
> I would like add column names so I can use reshape's cast method.

names(df) <- c("col1", "col2", ..., "col5") ?

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list