How to set values

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set values

arunkumar1111
This post has NOT been accepted by the mailing list yet.
Hi

I have a variable str = " X", "Y" and values ("0","12")

 i want to set value for X =0 and Y =12 and use inside the program.
how to do this
Please anybody help me.
Thanks in Advance
        Arun
Reply | Threaded
Open this post in threaded view
|

Re: How to set values

jorgeA
I'm not sure if I have understood your question, so I will put two possibilities:

1 - You have a variable called X ="0" and a variable called Y = "12" and want that to be numeric. You can do this:

X <- as.numeric(X)
Y <- as.numeric(Y)

2 - You have a variable called XY = "0","12" and want to make a list of numeric. Then you can do something like this:

XY <- as.numeric(unlist(strsplit(XY, ",")))

I hope this helps,

Best regards
Jorge Aikes Junior