Dear list, After searching many old posts, I can't find the solution to a simple problem. can someone tell me how to create a character string with multiple backslashes, as in: file_dir <- c("C:\files\data\") I need to create this string and then paste it to many files names for batch processing in another software program. R won't accept the backslash and removes it. Thanks for any suggestions, zack [[alternative HTML version deleted]]
Try: file_dir <- "C:\\files\\data\\" On Mon, Aug 4, 2008 at 5:02 PM, zack holden <zack_holden at hotmail.com> wrote:> > Dear list, > > After searching many old posts, I can't find the solution to a simple problem. > > can someone tell me how to create a character string with multiple backslashes, as in: > > file_dir <- c("C:\files\data\") > > I need to create this string and then paste it to many files names for batch processing in another software program. R won't accept the backslash and removes it. > > Thanks for any suggestions, > > zack > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
You have to escape every backslash by a second backslash - try this: f <- "C:\\files\\data\\" # create character string write(f, "AAAA") # write to file system("open -t AAAA") # see what happen to the character string> file_dir <- c("C:\files\data\")________________________________________________________ Christoph Heibl Systematic Botany Ludwig-Maximilians-Universität München Menzinger Str. 67 D-80638 München GERMANY phone: +49-(0)89-17861-251 e-mail: heibl@lmu.de http://www.christophheibl.de/ch-home.html SAVE PAPER - THINK BEFORE YOU PRINT>[[alternative HTML version deleted]]
Please read the R for Windows FAQs. Uwe Ligges zack holden wrote:> Dear list, > > After searching many old posts, I can't find the solution to a simple problem. > > can someone tell me how to create a character string with multiple backslashes, as in: > > file_dir <- c("C:\files\data\") > > I need to create this string and then paste it to many files names for batch processing in another software program. R won't accept the backslash and removes it. > > Thanks for any suggestions, > > zack > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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.