Pooya Lalehzari
2013-Aug-15 20:16 UTC
[R] How can I create a data_table with 1000 variables (Var1:Var1000)
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]]
Bert Gunter
2013-Aug-15 20:24 UTC
[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
Siraaj Khandkar
2013-Aug-15 20:33 UTC
[R] How can I create a data_table with 1000 variables (Var1:Var1000)
On 08/15/2013 04:16 PM, Pooya Lalehzari wrote:> Hello everyone, > How can I create a data_table with 1000 variables (Var1:Var1000)? >I'm not familiar with data_table, but here's an example to get you started in figuring this out: > n <- 3 > var.range <- 1:n > prefix <- "Var" > data <- as.data.frame(as.list(var.range)) > names(data) <- paste(prefix, var.range, sep="") > data Var1 Var2 Var3 1 1 2 3
Pooya Lalehzari
2013-Aug-15 21:09 UTC
[R] How can I create a data.table with 1000 variables (Var1:Var1000)
Here is the sample code.
Large_Table = data.frame(
Var1=numeric(),
Var2=numeric(),
Var3=numeric(),
.
.
.
Var1000=numeric())
Ideally, I would like to say
Large_Table = data.frame(
Var1-Var1000=numeric()
)
Or maybe the answer is not to declare them and just create the variables as
needed (i.e. in the for-loop that will use the data.frame.)
-----Original Message-----
From: arun [mailto:smartpink111 at yahoo.com]
Sent: Thursday, August 15, 2013 5:04 PM
To: Pooya Lalehzari
Subject: Re: [R] How can I create a data.table with 1000 variables
(Var1:Var1000)
This question is still not clear.? Could you show a reproducible example as to
what you want?? In the title, it says to create 1000 variable and now your
explanation is "refer".? Also, it is unclear as to what function in
SAS you are referring to.? As Bert said, please follow the posting guide while
posting.
Best.
----- Original Message -----
From: Pooya Lalehzari <plalehzari at platinumlp.com>
To: Bert Gunter <gunter.berton at gene.com>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Sent: Thursday, August 15, 2013 4:27 PM
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.
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.