Re: [R] Remove all spaces from a string so it can be used by assign() -- A Fortune?

2009-07-07 Thread Kurt Smith
rg [mailto:r-help-boun...@r-project.org] On > Behalf Of Greg Snow > Sent: Friday, July 03, 2009 7:00 PM > To: Kurt Smith; r-help@r-project.org > Subject: Re: [R] Remove all spaces from a string so it can be used by > assign() > > The only people who should use the assign functi

Re: [R] Remove all spaces from a string so it can be used by assign() -- A Fortune?

2009-07-06 Thread Bert Gunter
Subject: Re: [R] Remove all spaces from a string so it can be used by assign() The only people who should use the assign function are those who fully understand why you should never use the assign function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s

Re: [R] Remove all spaces from a string so it can be used by assign()

2009-07-06 Thread John Kane
hat. --- On Fri, 7/3/09, Kurt Smith wrote: > From: Kurt Smith > Subject: Re: [R] Remove all spaces from a string so it can be used by assign() > To: romain.franc...@dbmail.com > Cc: r-help@r-project.org > Received: Friday, July 3, 2009, 8:34 AM > > Thanks for the help

Re: [R] Remove all spaces from a string so it can be used by assign()

2009-07-03 Thread jim holtman
It all depends on what you want to do with the object. If you use back quotes, you can have the object named anything you want (I think this was pointed out in a previous reply): > `56Fe2` <- 1:10 # assign a value > `56Fe2` * 3 # do an operation on it [1] 3 6 9 12 15 18 21 24 27 30 > get('

Re: [R] Remove all spaces from a string so it can be used by assign()

2009-07-03 Thread Jason Rupert
Don't think you can have numerics as the first characters in a variable name. R ninjas can confirm, but I think you will be able to have numerics after an initial alpha character, e.g. Fe56 is ok, but 56Fe is not ok. Also, check out "gsub". This is a really powerful string editing tool.

Re: [R] Remove all spaces from a string so it can be used by assign()

2009-07-03 Thread Greg Snow
The only people who should use the assign function are those who fully understand why you should never use the assign function. If you tell us where the string is coming from and what you are trying to accomplish, then maybe we can help you accomplish it in a better way. -- Gregory (Greg) L. S

Re: [R] Remove all spaces from a string so it can be used by assign()

2009-07-03 Thread Kurt Smith
, "56 > Fe [1]" ) ) > [1] "Fe156" > > others probably have a one call solution > > >> R> gsub( "[^[:alnum:]]", "", "56 Fe [1]" ) > >> [1] "56Fe1" > > > > > > > > > Date:

Re: [R] Remove all spaces from a string so it can be used by assign()

2009-07-03 Thread Romain Francois
others probably have a one call solution R> gsub( "[^[:alnum:]]", "", "56 Fe [1]" ) [1] "56Fe1" > Date: Fri, 3 Jul 2009 13:09:20 +0200 > From: romain.franc...@dbmail.com > To: kurt.sm...@hotmail.co.uk > CC: r-help@r-project.org &g

Re: [R] Remove all spaces from a string so it can be used by assign()

2009-07-03 Thread Romain Francois
On 07/03/2009 12:56 PM, Kurt Smith wrote: Hi I have a string "56 Fe [1]" that I would like to use as a variable name by using "assign" however I think the spaces and brackets might be causing R some trouble. Not really; R> assign( "56 Fe [1]", 10 ) R> `56 Fe [1]` [1] 10 How can I change t