Re: [R] Regression expression to delete one or more spaces at end of string

2016-08-02 Thread David R Forrest
Double the [[]] and add a + for one-or-more characters: sub("[[:blank:]]+$", "", COLNAMES) > On Aug 2, 2016, at 12:46 PM, Dennis Fisher wrote: > > R 3.3.1 > OS X > > Colleagues, > > I have encountered an unexpected regex problem > > I have read an Excel file into R using the readxl packa

Re: [R] Regression expression to delete one or more spaces at end of string

2016-08-02 Thread William Dunlap via R-help
First, use [[:blank:]] instead of [:blank:]. that latter matches colon, b, l, a, n, and k, the former whitespace. Second, put + after [[:blank:]] to match one or more of them. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Aug 2, 2016 at 9:46 AM, Dennis Fisher wrote: > R 3.3.1 > OS X > >

Re: [R] Regression expression to delete one or more spaces at end of string

2016-08-02 Thread Marc Schwartz
> On Aug 2, 2016, at 11:46 AM, Dennis Fisher wrote: > > R 3.3.1 > OS X > > Colleagues, > > I have encountered an unexpected regex problem > > I have read an Excel file into R using the readxl package. Columns names are: > > COLNAMES <- c("Study ID", "Test and Biological Matrix", "Subj

[R] Regression expression to delete one or more spaces at end of string

2016-08-02 Thread Dennis Fisher
R 3.3.1 OS X Colleagues, I have encountered an unexpected regex problem I have read an Excel file into R using the readxl package. Columns names are: COLNAMES<- c("Study ID", "Test and Biological Matrix", "Subject No. ", "Collection Date", "Collection Time", "Scheduled Time Point",