[R] Dealing with parentheses within variable names

Duncan Murdoch murdoch.duncan at gmail.com
Thu Feb 28 22:45:48 CET 2013

On 28/02/2013 11:08 AM, Jesus Munoz Serrano wrote:
> Dear all
> I'm having some problems with a data set that has parenthesis within the variable names. A example of this kind of variable names is the following:
> 				fBodyGyroskewness()Z
> The case is that R is having a lot of troubles to identify the variable (probably it does understand it like a function). I've tried (among other things) to remove the parenthesis from the name using the following command:
> 				names(dataFrame) <- sub("()","", names(dataFrame))
> but It didn't work.  Sorry if it's a silly issue but I would really appreciate if anybody could help me. Thank you very much.
R shouldn't have trouble with names like that, but a lot of packages 
will (e.g. the ones that construct strings and call parse() on them).  
If you find functions in base R that object to those names, I think we'd 
like to fix them.  If the functions are in contributed packages, your 
mileage may vary.

Duncan Murdoch

More information about the R-help mailing list