Skip to content
Back to formatted view

Raw Message

Message-ID: <20050513161416.GD7857@med.unibs.it>
Date: 2005-05-13T16:14:16Z
From: stefano iacus
Subject: how to generate object name automatically?
In-Reply-To: <cedaa40b05051308246444914c@mail.gmail.com>

What about assign?

assign(raw.labs[1],123)

maybe you're thinking about something like this

(raw.values = vector of values)

for(i in 1:length(raw.labs))
  assign(raw.labs[i],raw.values[i])


Not elegant but works

Stefano


On Fri, May 13, 2005 at 11:24:24PM +0800, Xiao Shi wrote:
<Xiao>Hi everybody,
<Xiao>I have a lable vector ,
<Xiao>raw.labs= paste("file1", 1:20, sep = "")
<Xiao>And i can i make the content of raw.labs to be a object name.
<Xiao>eg ,file1=123(use some function on raw.labs to generate the name file1)
<Xiao>Thanks!
<Xiao>
<Xiao>	[[alternative HTML version deleted]]
<Xiao>
<Xiao>______________________________________________
<Xiao>R-help at stat.math.ethz.ch mailing list
<Xiao>https://stat.ethz.ch/mailman/listinfo/r-help
<Xiao>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html