[R] How can I create a data.table with 1000 variables (Var1:Var1000)

Steve Taylor steve.taylor at aut.ac.nz
Fri Aug 16 05:56:43 CEST 2013


How about this:

df1000cols = setNames(as.data.frame(matrix(numeric(0),ncol=1000)),paste0("V",1:1000))


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Pooya Lalehzari
Sent: Friday, 16 August 2013 8:27a
To: Bert Gunter
Cc: r-help at r-project.org
Subject: Re: [R] How can I create a data.table with 1000 variables (Var1:Var1000)

Sorry. data.table or even data.frame (as they are related). My question is, if there is a short form to refer to all 1000 of them similar to what exists in SAS.

Thank you,
Pooya Lalehzari.


-----Original Message-----
From: Bert Gunter [mailto:gunter.berton at gene.com]
Sent: Thursday, August 15, 2013 4:24 PM
To: Pooya Lalehzari
Cc: r-help at r-project.org
Subject: Re: [R] How can I create a data_table with 1000 variables (Var1:Var1000)

Please:

1. Define "data_table"  (??)

2. Follow the advice from the posting guide link below to post a coherent question.

-- Bert

On Thu, Aug 15, 2013 at 1:16 PM, Pooya Lalehzari <plalehzari at platinumlp.com> wrote:
> Hello everyone,
> How can I create a data_table with 1000 variables (Var1:Var1000)?
>
> Thank you,
> Pooya Lalehzari
>
>
>
> THIS E-MAIL IS FOR THE SOLE USE OF THE INTENDED RECIPIENT(S) AND MAY 
> CONTAIN CONFIDENTIAL AND PRIVILEGED INFORMATION.ANY UNAUTHORIZED 
> REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT 
> THE INTENDED RECIPIENT, PLEASE CONTACT THE SENDER BY REPLY E-MAIL AND DESTROY ALL COPIES OF THE ORIGINAL E-MAIL.
>         [[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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



THIS E-MAIL IS FOR THE SOLE USE OF THE INTENDED RECIPIENT(S) AND MAY CONTAIN
CONFIDENTIAL AND PRIVILEGED INFORMATION.ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE
OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, PLEASE
CONTACT THE SENDER BY REPLY E-MAIL AND DESTROY ALL COPIES OF THE ORIGINAL E-MAIL.
______________________________________________
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