Re: [R] Formatting a path for unix with gsub

2012-12-17 Thread William Dunlap
Use either > gsub(" ", " ", "one two three") # double space after 'two' [1] "one\\ two\\ \\ three" or > gsub(" ", "\\ ", "one two three", fixed=TRUE) [1] "one\\ two\\ \\ three" When 'fixed' is not TRUE then a backslash gives a special meaning to the next character in the replacement

Re: [R] Formatting a path for unix with gsub

2012-12-17 Thread David Winsemius
On Dec 17, 2012, at 9:44 AM, Nathan Skene wrote: > I have a path: > > path = "/nfs/users/nfs_n/ns9/ > Phenotype Analysis/Results/Run_AmplRatio_neg > BinaryAll trained without akapn+tnik.csv" > > I wish to replace the spaces with "\ " so that it can be read by a system > call to unix. > > Using