search for: gsub

Displaying 20 results from an estimated 1765 matches for "gsub".

Did you mean: grub
2007 Jan 19
3
How to have 'o' == 'ö'
...retrieve the document. Which it does not currently. Anyone have any good solutions to this problem? I suppose I could filter the documents and queries first which something like: (Iconv.new(''US-ASCII//TRANSLIT'', ''utf-8'').iconv "M?ngrel ?Horsemen?").gsub(/[^a-zA-Z0-9/im,"") But perhaps there is a better, or built in solution. Thanks -- Posted via http://www.ruby-forum.com/.
2008 Aug 25
1
Unicode notation \x000
Dear list, I am trying to replace Unicode notation of German and Spanish special characters (as read in by read.csv from excel spreadsheets) by character strings that can be interpreted by LaTeX. E.g.: uni2latex <- function(x){ x <- gsub("&", "et", x, fixed = TRUE) # Deutsch x <- gsub("\u0080", "\\\"A", x, fixed = TRUE) x <- gsub("\u008a", "\\\"a", x, fixed = TRUE) x <- gsub("\u0085", "\\\"O", x, fixed = TRUE) x &lt...
2018 Feb 17
2
readLines interaction with gsub different in R-dev
| Confirmed for R-devel (current) on Ubuntu 17.10. But ... isn't the regexp | you use wrong, ie isn't R-devel giving the correct answer? No, I don't think R-devel is correct (or at least consistent with the documentation). My interpretation of gsub("(\\w)", "\\U\\1", entry, perl = TRUE) is "Take every word character and replace it with itself, converted to uppercase." Perhaps my example was too minimal. Consider the following: R> gsub("(\\w)", "\\U\\1", entry, perl = TRUE) [1] "A&quo...
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 fra...
2010 Feb 19
8
Weird gsub behaviour
ruby 1.8.6 (2007-09-24 patchlevel 111) str = ''\&123'' puts "abc".gsub("b", str) puts "abc".gsub("b", "#{str}") puts "abc".gsub("b", str.to_s) puts "abc".gsub("b", ''\&123'') puts "abc".gsub("b", "\&123") >ruby test.rb ab123c ab123c...
2013 Nov 06
1
Multiple String word replacements: Performance Issue
...**Main code:** library("parallel") library("stringr") preprocessText<-function(x){ # Replace the 'html-and' arguments<-list(pattern="\\&amp\\;",replacement="and",x=x, ignore.case=TRUE) y<-do.call(gsub, arguments) # Remove some special characters arguments<-list(pattern="[^-[:alnum:]\\'\\:\\/\\$\\%\\.\\,\\+\\-\\#\\@\\_\\!\\?+[:space:]]",replacement="",x=y, ignore.case=TRUE) y<-do.call(gsub, arguments) # Lowercase argu...
2006 Apr 18
4
upcase special chars (åäöü...)?
Hey guys How do you upcase the special characters (????)? I use latin-1 and not utf-8. How did you solve this problem? (nice ruby way or ugly hack doesnt matter) Daniel -- Posted via http://www.ruby-forum.com/.
2004 Jul 17
2
gsub(*, perl=TRUE) bug incl. seg.fault (PR#7108)
Experimenting a bit further, I've "found" the following 1) the problem seems only gsub(), not sub() > sub(" ", "", "b c + d | a * b", perl=TRUE) [1] "bc + d | a * b" > gsub(" ", "", "b c + d | a * b", perl=TRUE) NULL 2) only if perl = TRUE, not otherwise 3) Also modifying the replacement string onl...
2002 Jul 23
2
sub() and gsub() (PR#1826)
Full_Name: Jerome Asselin Version: 1.5.1 OS: linux redhat 7.2 Submission from: (NULL) (142.103.173.179) gsub() return different answers depending on how the input variables were created. Here is an example of code that replicates the problem. The vectors y and yy appear to be the same, but gsub() doesn't return the same answer. It should remove all the blanks when I use the vector y, but it doesn'...
2001 Aug 02
1
gsub() and parenthesis symbols
Dear R-users -- I'm using R 1.3.0 on a PC running SuSE Linux 7.1. I'm confused by the following behavior from the gsub() function. Am I doing something wrong? ## A string of characters > string<-c("q","w","e","(",")","q","w","e") ## Use gsub to replace `q' with `A' > gsub("q","A",string) [1] &quo...
2009 May 21
4
Re placing a "+" in a string
I know this is easy, but I am stumped: > gsub("0","K","8.00+00") [1] "8.KK+KK" > gsub("+","K","8.00+00") Error in gsub("+", "K", "8.00+00") : invalid regular expression '+' In addition: Warning message: In gsub("+", "K...
2012 Sep 30
3
How to escape a forward slash with gsub, also does interpolation work with gsub?
I am trying this: I want to replace all the text in between java comments: /* start */ replace this text here /* end */ I''m trying: text.gsub(//* start */(.*)/* end *//im, replace_with) But i''m getting errors relating to expecting keyword_end. How should I be escaping /* and */ ? Also, does string interpolation work in gsub regex? Say I had variables like: start_tag = "/* start */" end_tag = "/* end */&quot...
2008 Sep 23
4
gsub difficulty
Greetings R-ians: I know what doesn?t work but I don?t know why, nor how to remedy things. I have a character string containing "." which I want to replace with " " gsub(".", " ", file.label) replaces the every character with a blank. However gsub(".xls", " ", file.label) replaces ".xls" with a blank as expected. It appears that "." is some kind of wild-card. How do I tell gsub that a period is just a p...
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 ar...
2018 Feb 17
2
readLines interaction with gsub different in R-dev
I was told to re-raise this issue with R-dev: In the documentation of R-dev and R-3.4.3, under ?gsub > replacement > ... For perl = TRUE only, it can also contain "\U" or "\L" to convert the rest of the replacement to upper or lower case and "\E" to end case conversion. However, the following code runs differently: tempf <- tempfile() writeLines(enc2utf...
2018 Feb 17
0
readLines interaction with gsub different in R-dev
I think the problem in R-devel happens when there are non-ASCII characters in any of the strings passed to gsub. txt <- vapply(list(as.raw(c(0x41, 0x6d, 0xc3, 0xa9, 0x6c, 0x69, 0x65)), as.raw(c(0x41, 0x6d, 0x65, 0x6c, 0x69, 0x61))), rawToChar, "") txt #[1] "Am?lie" "Amelia" Encoding(txt) #[1] "unknown" "unknown" gsub(perl=TRUE, "(\\w)(\\w)", &qu...
2005 Nov 27
4
gsub syntax
Hello I know that R's string functions are not as extensive as those of Unix but I need to do some text handling totally within an R environment because the target is a Windows system which will not have the corresponding shell utilities, sed, awk etc. Can anyone explain the following gsub phenomenon to me: > dates<-c("73","74","02","1973","1974","2002") I want to take just the last two digits where it is a 4-digit year and both digits when it is a 2-digit year. I should be able to use substr but measurement from th...
2004 Aug 27
3
gsub, backslash and xtable
...(temp2)) [1] "5%" "10%" "25%" "50%" "75%" "90%" "95%" I use xtable to convert the data.frame to Latex but I want to protect these % signs from Latex using a backslash in the normal way before calling xtable. I have tried using gsub as follows; > gsub("\%","\\%",pp) [1] "5%" "10%" "25%" "50%" "75%" "90%" "95%" also > gsub("%","\134%",pp) #octal for backslash [1] "5%" "10%" "25%"...
2009 Nov 16
2
on gsub (simple, but not to me!) sintax
..._11_101110_V", "V_11_101110_V", "V_11_101110_V", "V_17_101110_V", "V_17_101110_V") I'm able to do this on the emacs buffer through query-replace-regexp C-M-% search for V_\(.\)_ and substitute with V_0\1_ but I completely ignore how to do it with gsub within R and the help is quite complicate to understand (at least to me, at this moment in time) I can search the vector through grep("V_._", foo) but I always get errors either on gsub('V_\(.\)_', 'V_0\1_', foo) or I get not what I'm looking for on gsub('V_._...
2009 May 21
2
help with gsub and date pattern
Dear List, I am having a problem using gsub to remove dates from a date/time string. For example: x<-c("5/31/2009 12:34:00","6/1/2009 1:14:00") I would like to remove the date and have just the time. I have tried: gsub("[0-9+]/[0-9+]/[0-9+]","",x) and various versions. I think my problem is th...