[R] Spitting a df Column Name

Simon Blomberg s.blomberg1 at uq.edu.au
Mon Jan 12 03:29:14 CET 2009


names(datanamessplit) <- gsub("count.", "", names(data))


On Sun, 2009-01-11 at 18:13 -0800, jimdare wrote:
> Hi,
> 
> If I have the following column names: 
> 
> names(data)
> [1] "count.run"   "count.walk"   "count.drive"
> 
> How do I split these so i get
> 
> names(datanamessplit)
> [1] "run"   "walk"   "drive"
> 
> Thanks for your help,
> Jim
-- 
Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
Faculty of Biological and Chemical Sciences 
The University of Queensland 
St. Lucia Queensland 4072 
Australia
Room 320 Goddard Building (8)
T: +61 7 3365 2506
http://www.uq.edu.au/~uqsblomb
email: S.Blomberg1_at_uq.edu.au

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

The combination of some data and an aching desire for 
an answer does not ensure that a reasonable answer can 
be extracted from a given body of data. - John Tukey.



More information about the R-help mailing list