On 08/06/2015 10:23 AM, Sarah Goslee wrote:
> Easiest? Use sub() to replace the periods after the fact.
> 
> You can also use the check.names or the col.names arguments to
> read.table() to customize your import.

Yes, check.names is the right idea.  Use check.names = FALSE, then use
sub() or gsub() to replace the spaces with underscores.

Duncan Murdoch

> Sarah
> 
> On Mon, Jun 8, 2015 at 10:15 AM, John Sorkin
> <jsor...@grecc.umaryland.edu> wrote:
>> I am reading a csv file. The column headers have spaces in them. The spaces 
>> are replaced by a period. I want to replace the space by another character 
>> (e.g. the underline) rather than the period. Can someone tell me how to 
>> accomplish this?Thank you,
>> John
>>
>> John David Sorkin M.D., Ph.D.
>> Professor of Medicine
>> Chief, Biostatistics and Informatics
>> University of Maryland School of Medicine Division of Gerontology and 
>> Geriatric Medicine
>> Baltimore VA Medical Center
>> 10 North Greene Street
>> GRECC (BT/18/GR)
>> Baltimore, MD 21201-1524
>> (Phone) 410-605-7119
>> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>>
>>

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to