Re: [R] create many variables at one time~

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Wed, 04 Jun 2008 20:07:59 -0300

Try this:

for(i in 1:100)assign(sprintf("id.%d", i), value = sample(1)) id <- ls(patt = "id.[0-9]")

On Wed, Jun 4, 2008 at 7:52 PM, Manli Yan <manliyanrhelp_at_gmail.com> wrote:

> I need to create 100 variable ,whose name is id.1,id.2~~~~id.100
> then I need to let a vector say id<-c(id.1,id.2....id.100)
> any easy way to do this?
> thanks a lot~
>
> [[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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

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

Received on Wed 04 Jun 2008 - 23:12:03 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 Thu 05 Jun 2008 - 00:30:47 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.

list of date sections of archive