similar to: How to use escape characters in a string

Displaying 20 results from an estimated 20000 matches similar to: "How to use escape characters in a string"

2010 Feb 08
2
the hat ^ in regular expression
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20100208/52a6d080/attachment.pl>
2005 Oct 31
6
getting last 2 charcters of a string, other "text" functions?
I wish to obtain the right-most n characters of a character string? What is the appropriate function? --------------------------------- [[alternative HTML version deleted]]
2010 Jun 30
1
backslash escape characters in JSON strings
Hi, I am trying to consume a web service that returns a JSON string, however, when I run > fromJSON(s) Error: '\/' is an unrecognized escape in character string starting "http:\/" because the string s contains a single backslash, which is the JSON escape character, but R expects 2 backslashes, I think. Is there anyway to preprocess the JSON string returned from the web
2009 Jun 16
1
turning off escape sequences for a string
Hello, I would like to create a matrix with one of the columns named $\delta$. I have also created columns $\beta_1$ , $\beta_2$, etc. However, it seems like \d is an escape sequence which gets automatically removed. (Using these names such that they work right in xtable -> latex) colnames(simpleReg.mat) <- c("$\beta_1$","$SE(\beta_1)$", "$\beta_2$",
2010 Jun 14
3
remove last char of a text string
Dear R experts, is there a simple way to remove the last char of a text string? substr() function use as parameter start end only... but my strings are of different length... 01asap05a -> 01asap05 02ee04b -> 02ee04 Thank you all, Gianandrea -- View this message in context: http://r.789695.n4.nabble.com/remove-last-char-of-a-text-string-tp2254377p2254377.html Sent from the R help mailing
1999 Aug 03
3
RW 0.64.2 substring() string truncation?
Hi, (First, apology for my earlier incorrectly addressed "subscribe" post.) Can somebody tell me what exactly is going on below. Basically, I am running into some kind of "string truncation" problem when I try to get a substring starting past the 8192nd character (see sample session below). There doesn't appear to be any problem creating the string, and nchar()
2011 Dec 04
2
Extract last 3 characters from numeric vector
Hi all, I have a numeric vector with 1 decimal place, and I'd like to extract the last 3 characters, including the decimal point. The vector ranges from 0 to 20. x <- round(runif(100)*20, digits=1) Some of numbers have 3 characters, and some have 4. I've read up on the substr() function but that extracts characters based on exact positions. How can I extract just the last 3
2008 Apr 07
2
"\0" gives no warning "unknown escape sequence" (PR#11107)
Full_Name: Volkmar Klatt Version: 2.6.2 OS: linux Submission from: (NULL) (84.147.0.178) Hello, the documentation article ?Quotes from package:base could be improved by discussing the meaning of "\0" escape sequence. In R (currently used: R-2.6.2), a "\0" in a string will silently terminate that string, just as it would in C code. There is no warning about an unknown escape
2009 Aug 17
1
regex problems with the escape character
Hi R-users and R-experts, I am having a hard time in figuring out how to tackle regex questions where the "backslash" character is an integral part of the string. Let me explain how I?came across?this problem : I wanted to clearly see all the components in the windows environmental path variable. This is a long string.?For easy readability, I wanted to split up this string so that each
2005 Apr 12
8
removing characters from a string
Is there a simple way in R to remove all characters from a string other than those in a specified set? For example, I want to keep only the digits 0-9 in a string. In general, I have found the string handling abilities of R a bit limited. (Of course it's great for stats in general). Is there a good reference on this? Or should R programmers dump their output to a text file and use something
2011 Sep 29
2
String manipulation with regexpr, got to be a better way
Help-Rs,   I'm doing some string manipulation in a file where I converted a string date in mm/dd/yyyy format and returned the date yyyy.   I've used regexpr (hat tip to Gabor G for a very nice earlier post on this function) in steps (I've un-nested the code and provided it and an example of what I did below.  My question is: is there a more efficient way to do this.  Specifically is
2010 Apr 30
2
drop last character in a names'vector
Hi, i have a vector filled with names: [1] Alvaro Adela ... [25] Beatriz Berta ... ... [100000] ... I would like to drop last character in every name. I use the next program: for (i in 1:100000) { ? ? ? ? ? ? ? ? ? ? ? ? ? largo <- nchar(names[i]-1) ? ? ? ? ? ? ? ? ? ? ? ? ? names[i] <- substring (names[i],1,largo] ? ? ? ? ? ? ? ? ? ? ? ? ?} Is another and faster way of do it? Thanks,
2011 Jun 18
3
how to subtract one string from another in R
Dear R Group Here is what i am trying to do.. but couldnt figure out how.. string<-"ABC DEFG HIJKLM NOPQ RSTUV WXY" string1<-substr(string,1,4) I want to create an R object string 2 ( following the logic shown).. R does not allow string subtraction.. any suggestions how to achieve this? string2<-string-string1 (it should now hold "DEFG HIJKLM NOPQ RSTUV WXY" I
2020 Jun 26
2
Error in substring: invalid multibyte string
Hi all, I'm getting the following error from substring: > substr("<I>Jens Oehlschl\xe4gel-Akiyoshi", 1, 100) Error in substr("<I>Jens Oehlschl\xe4gel-Akiyoshi", 1, 100) : invalid multibyte string at '<e4>gel-A<6b>iyoshi' Is that normal / intended? I've tried setting the Encoding/locale to Latin-1/UTF-8 but that does not help. nchar
2010 Dec 30
2
Analysing Character Strings for subsequent frequency analysis
Hi I'm trying to get to grips with R and establish R as a teaching medium in my secondary school. I would like to use R to analyse text so I can produce frequency analysis of the text for subsequent examination of ciphers. I can produce code in VBA but I am struggling when writing in R to examine each character. There must be a clear method using the vectorised format of R. Furthermore,
2009 May 15
4
replace "%" with "\%"
Dear all, I'm trying to gsub() "%" with "\%" with no obvious success. > temp1 <- c("mean", "sd", "0%", "25%", "50%", "75%", "100%") > temp1 [1] "mean" "sd" "0%" "25%" "50%" "75%" "100%" > gsub("%",
2009 Mar 18
2
Profiling question: string formatting extremely slow
Hi all, I'm using R to find duplicates in a set of 6 files containing Part Number information. Before applying the intersect method to identify the duplicates I need to normalize the P/Ns. Converting the P/N to uppercase if alphanumerical and applying an 18 char long zero padding if numerical. When I apply the pn_formatting function (see code below) to "Part Number" column of the
2007 Oct 15
4
Get the last 3 chars of a string
I want to extract the last 3 letters of a string. So far, I've done this: > symbol = 'XYZ.VX" > substr(symbol,nchar(symbol)-2,nchar(symbol)) [1] ".VX" It works, but the code looks UGLY as hell. Am I missing something? Or is this the way it's supposed to be? Thanks, Sergio On 10/15/07, pintinho <diego at bpgomes.com> wrote: > > Hi everyone, >
2008 Feb 08
4
how to extract characters from a character string
Hi, I ran into a problem when I complied a dataset with UTM coordinates. For calculating distances between sites, I need to reformat the coordinates from, for example, 32?35.421 N, to 35.421, i.e. I need to delete all digits before symbol ? and a space and N at the end of the string. What functions I should use? Thanks in advance. Weidong Gu, Department of Medicine University of
2012 Jan 26
2
Inserting a character into a character string XXXX
Hello everyone, I have a character vector of 24 hour time values in the format hm without the delimiting ":". How can I insert the ":" immediately to the left of the second digit from the right? mytimes<-scan(what="") 1457 1457 1310 1158 137 1855 Thanks! Dan