I am using R & R Studio on Linux Mint 13, and I am trying to get a string that looks like this:
domain\username
but when I do this:
usr <- "domain\\username"
the resulting variable usr appears with two \\ in it:
#[1] "domain\\username"
Everything I have found indicates that this is the proper way to do this, yet, this is what I get. Any suggestions? Is there a setting askew?
may be the difference here between print and cat. So if you have the following string
usr <- "domain\\username"
and we go print(usr) we get
#[1] "domain\\username"
yet calling cat(usr) we get
#domain\username
which is what you're expecting correct? cat will actually evaluate the escapes, while print will just return the exact form of the object. You can test if your escapes are behaving as you think they should by using cat.
Check out the section on cat vs print here for a bit of info on it : R Inferno
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.