Re: [R] Replace sub string

2012-03-22 Thread Ajay Askoolum
Thanks. 1. For consistency: I am using / everywhere else in my script. 2. For ease of use: I am passing the string to a client application (using rcom) where it is easeir to handle / than \\. See ?gsub But why would you do that? Both / and \\ are valid in a p

Re: [R] Replace sub string

2012-03-22 Thread Ivan Calandra
Hi, See ?gsub But why would you do that? Both / and \\ are valid in a path, aren't they? Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosciences 6 Boulevard Gabriel 21000 Dijon, FRANCE +33(0)3.80.39.63.06 ivan.calan...@u-bourgogne.fr http://biogeosciences.u-bourgogne.fr/ca

[R] Replace sub string

2012-03-22 Thread Ajay Askoolum
Given: > filename<-paste(tempdir(),"\\","myfile.txt",sep=""); > sub("","/",filename); [1] "C:/DOCUME~1\\AJAYAS~1\\LOCALS~1\\Temp\\Rtmp2f270T\\myfile.txt" Note: Only the first occurence of \\ is replaced. What is the syntax for replacing every occurence? Thanks. [[alternative HTML