I have string as follows:"v:\work\gene" however, i can not write this as character string in R what i did is: path<- as.character("v:\work\gene") but it seems that \ is eliminated: Warning messages: 1: '\w' is an unrecognized escape in a character string 2: '\g' is an unrecognized escape in a character string 3: unrecognized escapes removed from "v:\work\gene"> path[1] "v:workgene" how can i keep the \ in string. thanks -- View this message in context: http://r.789695.n4.nabble.com/how-to-put-in-a-string-tp2062483p2062483.html Sent from the R help mailing list archive at Nabble.com.
Please see the FAQ on R for Windows2.16 where the distinction between the standard file separator "/" and the usual Windows file separator "\" is discussed. On Fri, Apr 23, 2010 at 12:37 PM, weix1 <weix1_2007@hotmail.com> wrote:> > I have string as follows:"v:\work\gene" > however, i can not write this as character string in R > what i did is: > path<- as.character("v:\work\gene") > > but it seems that \ is eliminated: > Warning messages: > 1: '\w' is an unrecognized escape in a character string > 2: '\g' is an unrecognized escape in a character string > 3: unrecognized escapes removed from "v:\work\gene" > > path > [1] "v:workgene" > > how can i keep the \ in string. > > thanks > > -- > View this message in context: > http://r.789695.n4.nabble.com/how-to-put-in-a-string-tp2062483p2062483.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Hi weix1, Try either "v:\\work\\gene" or "v:/work/gene". For more information see "Basic Regular Expressions" under ?regex as well as the Windows FAQ. HTH, Jorge On Fri, Apr 23, 2010 at 12:37 PM, weix1 <> wrote:> > I have string as follows:"v:\work\gene" > however, i can not write this as character string in R > what i did is: > path<- as.character("v:\work\gene") > > but it seems that \ is eliminated: > Warning messages: > 1: '\w' is an unrecognized escape in a character string > 2: '\g' is an unrecognized escape in a character string > 3: unrecognized escapes removed from "v:\work\gene" > > path > [1] "v:workgene" > > how can i keep the \ in string. > > thanks > > -- > View this message in context: > http://r.789695.n4.nabble.com/how-to-put-in-a-string-tp2062483p2062483.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]