Hi Etienne

It is not so elegant, bu I think that work.


colname.list<-paste("A",1:5,sep="")

df<-data.frame(matrix(matrix(rep(1,length(colname.list)),1),1))
df
colnames(df)<-colname.list
df

df<-df[-1,]
df

Cheers,


Miltinho Astronauta
Brazil

On 8/4/08, Etienne Bellemare Racine <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> Given a string list,
>    > paste("A",1:5,sep="")
>    [1] "A1" "A2" "A3" "A4" "A5"
>
> I would like to create an empty data frame using that list as the
> header, so I can access my data frame column using,
>    > df [ list [ i ] ]
>
> Anyone ?
>
> Thanks,
> Etienne
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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]]

______________________________________________
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.

Reply via email to