... But of course R is not C++ or Java, so there is no need to "declare" anything, and the OP's question strongly suggests to me that he/she has made no effort to learn R. My advice would be:
1. Stop posting. 2. Read An Introduction to R or other R tutorial and learn how the language works. -- Bert On Thu, Aug 15, 2013 at 2:20 PM, arun <smartpink...@yahoo.com> wrote: > > > Hi, > > May be this helps: > Large_Table<- data.frame(lapply(paste0("Var",1:1000),function(x) > {x1<-data.frame(numeric());colnames(x1)<-x; x1})) > str(Large_Table) > 'data.frame': 0 obs. of 1000 variables: > $ Var1 : num > $ Var2 : num > ---------------------------- > A.K. > > > > ----- Original Message ----- > From: Pooya Lalehzari <plalehz...@platinumlp.com> > To: arun <smartpink...@yahoo.com> > Cc: "r-help@r-project.org" <r-help@r-project.org> > Sent: Thursday, August 15, 2013 5:09 PM > Subject: RE: [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:smartpink...@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 <plalehz...@platinumlp.com> > To: Bert Gunter <gunter.ber...@gene.com> > Cc: "r-help@r-project.org" <r-help@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.ber...@gene.com] > Sent: Thursday, August 15, 2013 4:24 PM > To: Pooya Lalehzari > Cc: r-help@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 <plalehz...@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@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@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. > > ______________________________________________ > 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. -- 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 ______________________________________________ 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.