search for: backslashes

Displaying 20 results from an estimated 1085 matches for "backslashes".

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 Apr 11
3
Regexp pattern but fixed replacement?
I noticed this issue in stringr::str_replace, but it also affects sub() in base R. If the pattern in a call to one of these needs to be a regular expression, then backslashes in the replacement text are treated specially. For example, gsub("a|b", "\\", "abcdef") gives "def", not "\\\\def" as I wanted. To get the latter, I need to escape the replacement backslashes, e.g. gsub("a|b", "\\\\",...
2012 Mar 07
1
gsub: replacing double backslashes with single backslash
Hello everybody, this might be a trivial question, but I have been unable to find this using Google. I am trying to replace double backslashes with single backslashes using gsub. There seems to be some unexpected behaviour with regards to the replacement string "\\". The following example uses the string C:\\ which should be converted to C:\ . > gsub("\\\\", "\\", "C:\\") [1] "C:"...
2009 Aug 07
2
xtable, sweave and resizebox
does anyone know to rezize a table produzed by xtable? The size of my table is too big and I would like to resize it like using resizebox but it gives an erros when I try using it using it its fine \SweaveOpts{echo=false} <<results=tex>>= xtable(stats0,caption='Número de transacções dos artigos frequentes e infrequentes',label='tab:INEStats') @ but the size is too
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 ------------------------
2004 Nov 30
3
Problem with print() and backslashes.
...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( "\!" ) [1] "!" Now I try it differently... > print( "\\!" ) [1] "\\!" The output contains two backslashes. Why? Regards, Kevin
2020 May 15
3
edit() doubles backslashes when keep.source=TRUE
Is it just my installation or does edit() (or fix(), etc.) in R-4.0.0 double all the backslashes when options(keep.source=TRUE)? E.g., > options(keep.source=TRUE) > f <- function(x) { cat("\t", x, "\n", sep="") } > edit(f) # exit the editor without making any changes The editor (vi or notepad) shows doubled backslashes function(x) { cat("\\t...
2009 Apr 03
2
Removing backslashes from data
I am trying to check for backslashes in data, then remove them when I find them, but am having a difficult time figuring out the best way to do it. I know the backslash is the escape character in R, and I should be able to use 'gsub' to accomplish this, but I all I seem to be getting are errors. For example: If entr...
2007 Apr 27
1
Problem with formatted xtable in R 2.5.0
...lash$textbf\{big green\} & $\backslash$color\{green\}green \\ red & $\backslash$color\{red\}$\backslash$textbf\{big red\} & $\backslash$color\{red\}red \\ \hline \end{tabular} \end{center} \end{table} Please, note that the curly braces are prefixed with a backslash and the double backslashes are interpreted as math backslashes. The above code snippet worked fine in R 2.4.1 and I reckon that this behaviour might be due to: o There is a warning if \ is used unnecessarily in a string when being parsed, e.g. "\." where probably "\\." was intended. ("\." is...
2011 Aug 30
2
url prep function (backslash issue)
Greeting R Community, I am a windows user so this problem may be specific to windows. I often want to source files from within R such as: C:\Users\Rinker\Desktop\Research & Law\Data\School Data 09-10. To source this file I need to go through the path and replace all the backslashes (\) with forward slashes (/). I usually do this in MS Word using the replace option, however, I'd like to do this in R. Attempting to write a function to do this runs into problems: When I enter the following: readyPath <- function(path){ z <- gsub("\", "/", pat...
2009 Apr 22
1
Upgrading from 1.4.21.2 to 1.6.0.5 breaks sql queries with backslashes?
Hi, all. I've been searching google, bug reports and forums and have looked in all the asterisk-users list archives back to 2003 but haven't seen an answer to this, so thought I'd post here. The problem seems to be that Asterisk 1.6.0.5 is sending backslashes (needed to escape commas and so forth in 1.4.21.2) as *literal* backslashes to Mysql, so that Mysql gives a syntax error and many things associated with app_addon_sql_mysql.c fail. I'm pretty sure this is an asterisk thing and not an addon thing because the query has the backslashes when a...
2008 Aug 04
3
backslash in character string?
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 delet...
2003 Aug 12
3
grep and gsub on backslash and quotes
...t good). But The R Language Manual tells me that Quotes and other special characters within strings are specified using escape sequences: \' single quote \" double quote so why is the following wrong: gsub("\\\\'", "\\\\"", line)? That or any other number of backslashes (have tried all up to n=6 just for good measure). BTW is it documented anywhere that you need four backslashes in an RE to match one in the target, when it is being passed as an argument to gsub or grep? How would I know how many levels of doubling up to use for any other functions? (I got to 4 co...
2006 Feb 01
3
inserting one backslash
Hello, I am not very familiar with regular expressions and escaping. I need to replace the %-signs in a character vector with elements as "income 0%-33%# to be replaced by "income 0\%-33\%" (for later use in LaTeX). Using gsub("%","\\%","income 0%-33%") does not give the desired result. However, gsub("%","\\\\%","income
2012 Dec 17
2
Formatting a path for unix with gsub
..." 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 trained without akapn+tnik.csv" Various variations on this result in either adding no backslashes, or two at once. How do I just get one backslash inserted? Thanks [[alternative HTML version deleted]]
2006 Jan 05
1
How do I get sub to insert a single backslash?
Something about the way R processes backslashes is defeating me. Perhaps this is because I have only just started using R for text processing. I would like to change occurrences of the ampersand & into ampersand preceded by a backslash. > temp <- "R & D" > sub("&", "\&", temp) [1] &quot...
2010 Jun 16
2
Backslash in paste() function
...h a backslash "\". I have: test <- c('foo','bar') and I need to rebuild the array, encapsulating the text items with latex stuff, like this: paste("\parbox[b]{3cm}{", test, "}", fill=TRUE) Actually, cat() prints the string fine if one uses double backslashes. However, I can't save the result from cat() back to a vector. And when I use cat() inside the latex function from the Hmisc package, I only get errors... The (not so) funny thing is that I can use paste() on a few latex commands. So if I needed to make the strings bold, the following works: p...
2004 Nov 29
4
escaping backslash in a string
...gle 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 fol...
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
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