Skip to content
Prev 304316 / 398503 Next

Create and Assign value into a variable from Another variable

Ok.
Here I have a variable called "Variable_1".

Variable_1 <- "MyDataFrame"

Here I want to create another variable, by assigning the value of
"Variable_1" .
So, it will come like,

Assign(Variable_1,data.frame(read.csv("c:\\Mydata.csv")))   --->[this
was the 1st requirement, now I got the solution]

Now, " MyDataFrame " is a variable and containing some values in that.
And Now, the problem what is I need to do "rbind" into the variable "
MyDataFrame ".

I tried to do,
rbind(as.character(Variable_1),
data.frame(read.csv("c:\\My2ndData.csv")))

Here I am getting stuck !


- Thanks
Antony

-----Original Message-----
From: Rui Barradas [mailto:ruipbarradas at sapo.pt] 
Sent: Tuesday, August 28, 2012 3:48 PM
To: Akkara, Antony (GE Energy, Non-GE)
Cc: r-help
Subject: Re: [R] Create and Assign value into a variable from Another
variable

Hello,

Try the following, supposing that 1:5 is the value you want to assign.

?assign
MyVariable <- "UnitNo"
assign(MyVariable, 1:5)
UnitNo

Hope this helps,

Rui Barradas

Em 28-08-2012 07:48, Rantony escreveu:
that.