Xavier Fernández i Marín
2003-Oct-30 16:54 UTC
[R] RMySQL and '_' character in column names
Hi, I'm using RMySQL in order to obtain data from my MySQL server. In my databases sometimes I have columns with names that contain '_' character (ex: 'gdp_capita', 'population_total', etc...). When these names appear as the names of the vectors in the data frame that I get, sometimes I have problems as:> cor(gdp_capita, population_total)Error: object "_capita" not found use of _ is soon to be removed. Is there an automatic way to transform the '_' characters in MySQL to '.' in R using RMysql? Thanks, Xavier
?make.names may help. On Thu, 30 Oct 2003, Xavier Fern?ndez i Mar?n wrote:> Hi, > > I'm using RMySQL in order to obtain data from my MySQL server. In my databases > sometimes I have columns with names that contain '_' character (ex: > 'gdp_capita', 'population_total', etc...). When these names appear as the > names of the vectors in the data frame that I get, sometimes I have problems > as: > > > cor(gdp_capita, population_total) > Error: object "_capita" not found > use of _ is soon to be removed. > > Is there an automatic way to transform the '_' characters in MySQL to '.' in R > using RMysql?-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595