Re: [R] How to create a mixed col.names?

From: Gabor Csardi <csardi_at_rmki.kfki.hu>
Date: Mon, 17 Dec 2007 15:22:01 +0100

paste(rep(c("Factor", "Sign Factor"), 5), rep(1:5, each=2))

Replace '5' with the desired number,
Gabor

On Mon, Dec 17, 2007 at 03:08:09PM +0100, Jonas Malmros wrote:
> Hello,
>
> I have a vector of names, say :
>
> names <- c("Factor 1", "Factor 2", Factor 3")
>
> I am creating a dataframe and I want the column names to be mixed like this:
> "Factor 1" " Sign Factor 1" "Factor 2" "Sign Factor 2" "Factor 3"
> "Sign Factor 3"
> How can I automate the creation of such a mixed vector? I tried with
> rep but did not succeed.
>
> Could someone please suggest a solution to this problem?
> Thanks in advance!
>
> Regards,
> JM
> --
> Jonas Malmros
> Stockholm University
> Stockholm, Sweden
>
> ______________________________________________
> 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.

-- 
Csardi Gabor <csardi_at_rmki.kfki.hu>    MTA RMKI, ELTE TTK

______________________________________________
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.
Received on Mon 17 Dec 2007 - 14:25:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Dec 2007 - 19:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.