Dear community, I have a problem with a string conversion:> text[1] "" "and" "\xc1d\xe1m" [4] "graphical" "interface" "MLP" [7] "Nagy" "networks" "Networks" [10] "neural" "Neural" "RBF" [13] "<sodzsu at yahoo.com>" "user" "with" [16] "and" "\xc1d\xe1m" "graphical" [19] "interface" "MLP">I need to get rid off text[3,17] ! I have this kind of control-sequence a few times in my text and I do not get rid of it, by strsplit or sub.> grep("\xc1d\xe1m",text)Error in grep("\xc1d\xe1m", text) : regular expression is invalid in this locale> grep("\\xc1d\\xe1m",text)integer(0) Warning messages: 1: In grep("\\xc1d\\xe1m", text) : input string 3 is invalid in this locale 2: In grep("\\xc1d\\xe1m", text) : input string 17 is invalid in this locale Thanks in advance, Georg
See ?Encoding and ?iconv: iconv("\xc1d\xe1m", from = '', to = 'latin1') On Sat, May 8, 2010 at 11:05 AM, Webby <mailing-list@gmx.net> wrote:> > Dear community, > > I have a problem with a string conversion: > > > text > [1] "" "and" "\xc1d\xe1m" > [4] "graphical" "interface" "MLP" > [7] "Nagy" "networks" "Networks" > [10] "neural" "Neural" "RBF" > [13] "<sodzsu@yahoo.com>" "user" "with" > [16] "and" "\xc1d\xe1m" "graphical" > [19] "interface" "MLP" > > > > I need to get rid off text[3,17] ! > > I have this kind of control-sequence a few times in my text and I do not > get > rid of it, by strsplit or sub. > > > grep("\xc1d\xe1m",text) > Error in grep("\xc1d\xe1m", text) : > regular expression is invalid in this locale > > grep("\\xc1d\\xe1m",text) > integer(0) > Warning messages: > 1: In grep("\\xc1d\\xe1m", text) : > input string 3 is invalid in this locale > 2: In grep("\\xc1d\\xe1m", text) : > input string 17 is invalid in this locale > > Thanks in advance, > Georg > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
On May 8, 2010, at 10:05 AM, Webby wrote:> > Dear community, > > I have a problem with a string conversion: > >> text > [1] "" "and" "\xc1d\xe1m" > [4] "graphical" "interface" "MLP" > [7] "Nagy" "networks" "Networks" > [10] "neural" "Neural" "RBF" > [13] "<sodzsu at yahoo.com>" "user" "with" > [16] "and" "\xc1d\xe1m" "graphical" > [19] "interface" "MLP" >> > > I need to get rid off text[3,17] !Does this work> text[ grep("[[:alnum:]]|", text) ] Still gives the warnings but seems to properly leave out the "control- sequences".> I have this kind of control-sequence a few times in my text and I do > not get > rid of it, by strsplit or sub. > >> grep("\xc1d\xe1m",text) > Error in grep("\xc1d\xe1m", text) : > regular expression is invalid in this locale >> grep("\\xc1d\\xe1m",text) > integer(0) > Warning messages: > 1: In grep("\\xc1d\\xe1m", text) : > input string 3 is invalid in this locale > 2: In grep("\\xc1d\\xe1m", text) : > input string 17 is invalid in this locale > > Thanks in advance, > Georg > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD West Hartford, CT