Re: [R] use value in variable to be name of another variable

2016-07-12 Thread Aedin Culhane
Hi Matt It looks like you are trying to obtain the upstream sequence data information given transcription factor binding sites??? There are a lot of functions in Bioconductor which are optimized for this type of analysis. If you wish to either post on the Bioconductor mailing list (https://s

Re: [R] use value in variable to be name of another variable

2016-07-12 Thread David L Carlson
XJGBW" "TCRWEY" "BUNKIF" "PUCWDB" ... $ CMXSLB: chr "MIQLWV" "LCWAJE" "CMPVHR" "HLDSOB" ... $ GOUDTJ: chr "XGCBVK" "VKLEQG" "EADZLR" "CWNDTF" ... $ SYMEXP: chr "RFIHTE&

Re: [R] use value in variable to be name of another variable

2016-07-11 Thread William Dunlap via R-help
I find that instead of using assign() and get(), it is more convenient to make an environment in which to store a related set of variables and then use env[[varName]] instead of get(varName) or assign(varName) to get and set variables. The advantages are * the same syntax works for setting and get

Re: [R] use value in variable to be name of another variable

2016-07-11 Thread Matthew
Hi Rolf, Thanks for the warning. I think because my initial efforts used the assign function, that Jim provided his solution using it. Any suggestions for how it could be done without assign() ? Matthew On 7/11/2016 6:31 PM, Rolf Turner wrote: On 12/07/16 10:13, Matthew wrote: Hi J

Re: [R] use value in variable to be name of another variable

2016-07-11 Thread Rolf Turner
On 12/07/16 10:13, Matthew wrote: Hi Jim, Wow ! And it does exactly what I was looking for. Thank you very much. That assign function is pretty nice. I should become more familiar with it. Indeed you should, and assign() is indeed nice and useful and handy. But it should be used with car

Re: [R] use value in variable to be name of another variable

2016-07-11 Thread David Winsemius
> On Jul 11, 2016, at 1:01 PM, Matthew wrote: > > I want to get a value that has been assigned to a variable, and then use that > value to be the name of a variable. > > For example, > > tTargTFS[1,1] > # returns: >V1 > "AT1G01010" > > Now, I want to make AT1G01010 the name o

Re: [R] use value in variable to be name of another variable

2016-07-11 Thread Matthew
Hi Jim, Wow ! And it does exactly what I was looking for. Thank you very much. That assign function is pretty nice. I should become more familiar with it. Matthew On 7/11/2016 5:59 PM, Jim Lemon wrote: Hi Matthew, This question is a bit mysterious as we don't know what the object "chr" i

Re: [R] use value in variable to be name of another variable

2016-07-11 Thread Jim Lemon
Hi Matthew, This question is a bit mysterious as we don't know what the object "chr" is. However, have a look at this and see if it is close to what you want to do. # set up a little matrix of character values tTargTFS<-matrix(paste("A",rep(1:4,each=4),"B",rep(1:4,4),sep=""),ncol=4) # try the assi

[R] use value in variable to be name of another variable

2016-07-11 Thread Matthew
I want to get a value that has been assigned to a variable, and then use that value to be the name of a variable. For example, tTargTFS[1,1] # returns: V1 "AT1G01010" Now, I want to make AT1G01010 the name of a variable: AT1G01010 <- tTargTFS[-1,1] Then, go to the next tTargTF