similar to: gsub: replacing double backslashes with single backslash

Displaying 20 results from an estimated 5000 matches similar to: "gsub: replacing double backslashes with single backslash"

2012 Dec 17
2
Formatting a path for unix with gsub
I have a path: path = "/nfs/users/nfs_n/ns9/ Phenotype Analysis/Results/Run_AmplRatio_neg BinaryAll trained without akapn+tnik.csv" I wish to replace the spaces with "\ " so that it can be read by a system call to unix. Using gsub I try: > gsub(" ","\\ ",path) [1] "/nfs/users/nfs_n/ns9/Phenotype Analysis/Results/Run_AmplRatio_neg BinaryAll
2011 Jul 17
3
gsub() with unicode and escape character
Dear helpers, I'm trying to replace a character with a unicode code inside a data frame using gsub(), but unsuccessfully. > data.frame(animals=c("dog","wolf","cat"))->my.data > gsub("o","\u0254",my.data$animals)->my.data$animals > my.data$animals [1] "d??g" "w??lf" "cat" It's not that a data
2023 May 30
3
why does [A-Z] include 'T' in an Estonian locale?
Inspired by this old Stack Overflow question https://stackoverflow.com/questions/19765610/when-does-locale-affect-rs-regular-expressions I was wondering why this is TRUE: Sys.setlocale("LC_ALL", "et_EE") grepl("[A-Z]", "T") TRE's documentation at <https://laurikari.net/tre/documentation/regex-syntax/> says that a range "is shorthand for
2023 Jun 01
1
why does [A-Z] include 'T' in an Estonian locale?
On 5/30/23 17:45, Ben Bolker wrote: > Inspired by this old Stack Overflow question > > https://stackoverflow.com/questions/19765610/when-does-locale-affect-rs-regular-expressions > > > I was wondering why this is TRUE: > > Sys.setlocale("LC_ALL", "et_EE") > grepl("[A-Z]", "T") > > TRE's documentation at >
2003 Aug 12
3
grep and gsub on backslash and quotes
The following code works, to gsub single quotes to double quotes: line <- gsub("'", '"', line) (that's a single quote within doubles then a double within singles if your viewer's font is not good). But The R Language Manual tells me that Quotes and other special characters within strings are specified using escape sequences: \' single quote \"
2004 Aug 27
3
gsub, backslash and xtable
R Version 1.9.1 (2004-06-21) Mac OS X.3.5 Dual 2GHz PowerPC G5 GUI = "AQUA" I have a data.frame comprising percentiles with the column headings containing % characters, e.g. > (pp <- colnames(temp2)) [1] "5%" "10%" "25%" "50%" "75%" "90%" "95%" I use xtable to convert the data.frame to Latex but I want to
2024 Aug 01
1
Question about regexp edge case
Thanks Tomas. Do note that my original post also mentioned a bug or doc error in the PCRE docs for this regexp: > - perl = TRUE does *not* give the documented result on at least one > system (which is "123456789", because "{,5}" is documented to not be a > quantifier, so it should only match the literal string "{,5}"). Duncan On 2024-08-01 6:49 a.m.,
2024 Jul 29
1
Question about regexp edge case
On StackOverflow (here: https://stackoverflow.com/questions/78803652/why-does-gsub-in-r-match-one-character-too-many) there was a question about this result: > gsub("^([0-9]{,5}).*","\\1","123456789") [1] "123456" The OP expected "12345" as the result. Several points were raised: - The R docs don't mention the case of {,5} for the
2006 Apr 24
3
gsub + backslashes
Dear developeRs, I thought that backslashes can be escaped in the usual way (and I think I did this before) but I can't see why R> gsub("\\", "x", "\alpha") Error in gsub(pattern, replacement, x, ignore.case, extended, fixed, useBytes) : invalid regular expression '\' gives an error. Or am I just blind? Best, Torsten R> version
2008 May 09
4
Gnome-terminal's backslashes look like Ws with a horizontal line through -- how to get a backslash?
Hello! I've just started trying gnome-terminal (instead of xterm) because of its "tabbing" facility. However, I note that with it backslashes appear something like a W with a horizontal line through it. Any known way to get a backslash to appear as a backslash? To see what I mean, use gnome-terminal with echo '\' in bash, ksh, etc. Regards, Chip Campbell
2024 Aug 09
1
Question about regexp edge case
On 8/1/24 20:55, Duncan Murdoch wrote: > Thanks Tomas.? Do note that my original post also mentioned a bug or > doc error in the PCRE docs for this regexp: > >> ? - perl = TRUE does *not* give the documented result on at least one >> system (which is "123456789", because "{,5}" is documented to not be >> a quantifier, so it should only match the
2009 Jun 09
6
[LLVMdev] Regular Expressions
On Tuesday 09 June 2009 04:35, Török Edwin wrote: > On 2009-06-09 12:27, Howard Su wrote: > > This change break the MSVC build since no regex by default in Windows > > MSVC platform. > > Perhaps we should add a regex implementation to lib/System? That's potentially a lot of work. I started looking at it and it would involve hiding the OpenBSD library under some other
2009 Jun 09
0
[LLVMdev] Regular Expressions
On Tue, Jun 9, 2009 at 12:00 PM, David Greene<dag at cray.com> wrote: > On Tuesday 09 June 2009 04:35, Török Edwin wrote: >> On 2009-06-09 12:27, Howard Su wrote: >> > This change break the MSVC build since no regex by default in Windows >> > MSVC platform. >> >> Perhaps we should add a regex implementation to lib/System? > > That's
2002 Aug 29
2
problem with toString
Hi, I am using R 1.5.1 under Windows 2000. I have a problem with the function toString: It seems not to work for longer vectors as expressions. This example works well: q1<-expression(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)) toString(q1) I get: "c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)" => OK But this one does not:
2006 May 17
1
changing single to double backslash
Hi, all. I didn't find something like this in the faq list: I wound like build a function to substitute single backslashes in a string to double: ChangeSlash<-function(dir) ... so ChangeSlash("C:\mydocs\test") returns "C:\\mydocs\\test" Thanks, C. _______________________________________________________ Abra sua conta no Yahoo! Mail: 1GB de espa?o, alertas
2011 Nov 04
3
replace double backslash with singel backslash
I want to replace \\ with \ in: str <- "C:\\DOKUME~1\\u0327336\\LOKALE~1\\Temp\\RtmpQ5NJ8X\\TIRIS_PICS\\1_Img.jpg" and tried: gsub("\\\\", "\\", str) but this removes the \\ without replacing them by \ Any help much appreciated, Kay ----- ------------------------ Kay Cichini Postgraduate student Institute of Botany Univ. of Innsbruck ------------------------
2011 Apr 29
1
regular expression in gsub() for strings with leading backslash
Hello, Can anyone help on gsub() in R? I have a string like something below, and wanted to delete all the strings with leading backslash, including "\xa0On", "\023, "\xab", and many others. How should I write a regular expression pattern in gsub()? I don't care how many characters following backslash. txt <- "Is This Thing\xa0On? http://bit.ly/jAbKem
2009 Jan 23
2
forward slash vs double backslash R and Tinn-R
I installed the newest version of R and once again ran into problem with Tinn-R failing when trying to use the R explorer. I had this problem once before and solved it when I added the following .trPaths = c( 'C:/Documents and Settings/fbuchins/Application Data/Tinn-R/tmp/', 'C:/Documents and Settings/fbuchins/Application Data/Tinn-R/tmp/search.txt', 'C:/Documents and
2009 Aug 24
0
[LLVMdev] Regular Expression lib support
On Sun, Aug 23, 2009 at 5:56 PM, Daniel Dunbar<daniel at zuster.org> wrote: > We would like to have access to some kind of regular expression > library inside LLVM. For example, we need this to extend the FileCheck > test case checking tool to support regular expressions. > > There are three obvious options: >  1. Roll our own library. Multiple unnamed individuals may even
2004 Nov 30
3
Problem with print() and backslashes.
Dear R List I have a small problem concerning the output of print(). My version: > R.version _ platform i386-portbld-freebsd5.2 arch i386 os freebsd5.2 system i386, freebsd5.2 status major 1 minor 9.0 year 2004 month 04 day 12 language R Consider this: I want to print a backslash with an exclamation mark. Here is the output. > print( "\!"