Skip to content
Back to formatted view

Raw Message

Message-ID: <49AEF675.2010404@uke.uni-hamburg.de>
Date: 2009-03-04T21:45:25Z
From: Eik Vettorazzi
Subject: how to create many variables at one time?
In-Reply-To: <6e61c2550903041334h7c83a46arc1177bccb7127bf7@mail.gmail.com>

Hi Manli,
you may consider structuring your data in some appropriate form like 
data.frame or list. Its often not the best way holding information 
separated in many variables.
But if you *really* want to create 100 separate variables, something like

for (i in 1:100) assign(paste("X",i,sep=""), some_values)

will do the job.


Manli Yan schrieb:
>   Hi:
>   I need to create many variables at one time,how to do this in R?
>   for eg ,X1,X2.......X100?
>
>  Thanks~
>
> 	[[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.
>   

-- 
Eik Vettorazzi
Institut f?r Medizinische Biometrie und Epidemiologie
Universit?tsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790