How can I get a single backslash in a character string? My goal is to escape dots in a string that will be used as a regular expression. I thought I could do it this way: gsub(".", "\\.", x) Unfortunately, "\\" does not represent a literal backslash as I expected, but rather a pair of backslashes:> "\\."[1] "\\."> "\\"[1] "\\" Just a backslash and a dot fails too, since that represents an escaped dot:> "\."[1] "." A single backslash works in the middle of strings sometimes,but it depends on what the character following it is (presumably depending on whether the pair of characters represents an escape sequence):> "a\b"[1] "a\b"> "x\y"[1] "xy" Is there a way to represent "\"? This seems like a design problem in the interpreter.> R.version_ platform i386-redhat-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major 2 minor 0.1 year 2004 month 11 day 15 language R
Dan Lipsitt <danlipsitt at gmail.com> writes:> How can I get a single backslash in a character string? > > My goal is to escape dots in a string that will be used as a regular > expression. I thought I could do it this way: > > gsub(".", "\\.", x) > > Unfortunately, "\\" does not represent a literal backslash as I > expected, but rather a pair of backslashes: > > > "\\." > [1] "\\." > > "\\" > [1] "\\"Nononononono.... If you want to know what is inside a string, use cat() not (implicitly) print()> cat( "\\.")\.> The thing is that print() itself escapes "weird" characters, including the escape character:> x <- readLines() # ctr-D terminates (on Linux anyway)\.> x[1] "\\."> Is there a way to represent "\"? This seems like a design problem in > the interpreter.Yes. Not at all. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Dear group, I am using justRMA in bioconductor to get expression values. Now I computed fold changes. the fold changes i get are log2 values. How can I convert these to log10 values to see them as actual fold change values. thank you.
Ah, I see. Thanks. ?print.default and ?cat do not mention this.
Srinivas Iyyer wrote:> Dear group, > I am using justRMA in bioconductor to get expression > values. Now I computed fold changes. the fold > changes i get are log2 values. > > How can I convert these to log10 values to see them as > actual fold change values.First, a bit of etiquette. It is considered impolite to post the same question to more than one listserv. Second, although this is not a BioC-specific question, that is probably a better place to ask. To answer; log10 values will *not* give you actual fold changes. These will be the same as log2, to a multiplicitive constant. You want to convert back to the natural scale e.g., 2^FC, where FC = your fold changes. Also note that you compute fold change on the log scale by subtraction, not division. HTH, Jim> > thank you. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html-- James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109
Maybe Matching Threads
- Re: remove non-portable chmod from libtool-kill-dependency_libs.sh (#10)
- Backslash Escaping in View
- backslash escape characters in JSON strings
- [Bug 3474] New: ssh_config can escape double quotes with a backslash
- Awkward escaping with five backslashes within \code{ } in new parse_Rd