similar to: substr not by position but by symbol

Displaying 20 results from an estimated 10000 matches similar to: "substr not by position but by symbol"

2018 Jan 22
2
substr gives empty output
In y <- substr(x, i, 1) your third integer needs to be the location not the number of digits, so change it to y <- substr(x, i, i) and you should get what you want. Cheers, Tim > Date: Sun, 21 Jan 2018 10:50:31 -0500 > From: Ek Esawi <esawiek at gmail.com> > To: Luigi Marongiu <marongiu.luigi at gmail.com>, r-help at r-project.org > Subject: Re: [R] substr
2006 Jun 17
2
substr or split help needed
Um texto embutido e sem conjunto de caracteres especificado associado... Nome: n?o dispon?vel Url: https://stat.ethz.ch/pipermail/r-help/attachments/20060617/d28b0fb4/attachment.pl
2012 Feb 18
1
is there a command to withdraw already performed command in R?
Hi all, Is there any command or function to withdraw a command performed already in R? For instance, after drawing a line in existing plot, can I remove the line in the plot? I know I can use a way of overlapping on the former line so that it looks like a removing the line, but I'm wondering there is a command to retract the already performed command. Thanks. YN [[alternative HTML
2012 Mar 28
1
What are the color's name in heat.color(5)
Hi all, I'm trying to using heat.color function in my data visualization. So, when I set col = heat.color(5), five different colors are displayed from red to weak yellow. But, now I want to know the color's keys or the names of the displayed heat.color. For instance, I think one of the five displayed colors seems to be 'red'. But, I'm not sure whether it is, also I don't
2013 Mar 13
5
string split at xth position
Hi, I have a vector of strings like: c("a1b1","a2b2","a1b2") which I want to spilt into two parts like: c("a1","a2","a2") and c("b1","b2,"b2"). So there is always a first part with a+number and a second part with b+number. Unfortunately there is no separator I could use to directly split the vectors.. Any idea
2008 Oct 29
6
substring/strsplit question
Dear R People: Here is a toy example: > x <- c("2E","5W","12H") > substr(x,2,2) [1] "E" "W" "2" > Sometimes x has 3 elements, sometimes 2. I want to extract the last element, and then extract the other 1 or 2 elements. How can I do this, please? TIA, Sincerely, Erin -- Erin Hodgess Associate Professor Department of
2009 Sep 25
7
Spliting columns, strings or reg exp returning substrings
Currently as the first column in a data frame I have string values in the format xx_yy - I want to create a new column with just the substring xx (for each row in turn). Three possible ways to do this might be (1) split the string by '_' using strsplit and paste the first of the resulting variables into a new column, but I have been unable to do this for each row of my data frame in turn
2003 Nov 07
3
Q. About String indexing
Hi all - this is a very basic question: how does one index substrings of a character string, for example get the 2nd through 5th characters of the string "testing", in the R language? Indexing with square brackets seems only to work for vectors, lists, etc., and although I've found plenty of functions for concatenating strings, running substitutions with regexps and the like, I seem
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,
2010 Oct 20
1
Adding Legend about two quantile lines at ggplot
Hi, all. I'd like to add legend on my graph but I can't. My code is follows. library(ggplot2) score1<-rnorm(100,0,5) score2<-rnorm(400,10,15) mydata<-data.frame(score1,score2) ggplot(mydata,aes(y=score2,x=score1))+geom_point()+stat_quantile(quantiles=c(0.50),col="red")+stat_quantile(quantiles=c(0.90),col="blue",size=2) I like to add legend indicating the
2008 Jun 03
4
wildcard symbol or character
hello all, i want to split a list into smaller lists. the list looks like this: CW-W730 CW-W720 CW-W710 CW-W700 CW-W690 CW-W680 CW-W670 CW-W660 CE-W997 CE-W987 CE-W977 CE-W967 CE-W956 CE-W944 CE-W934 CE-W924 7W-W760 7W-W750 7W-96 7W-941 7W-932 7W-923 7W-914 7W-905 7E-W565 7E-W555 7E-W545 7E-W535 7E-W525 7E-906 7E-850 7E-840 ... i want the smaller lists
2009 Apr 10
4
split a character variable into several character variable by a character
Dear Mao Jianfeng, "r-help-owner" is not the place for help, but: r-help at r-project.org (CC-ed here) In any case, strsplit() does the job, i.e.: > unlist(strsplit("BCPy01-01", "-")) [1] "BCPy01" "01" You can work with the whole variable, like: splitpop <- strsplit(df1$popcode, "-") then access the first part with >
2003 May 22
4
grep, gsub, sub have problems with NA values (PR#3078)
In a string context, grep, gsub, sub are improperly treating NA (missing) as the string "NA", and returning unexpected results > grep("A", c(NA,"NA")) [1] 1 2 # expected: # [1] 2 > gsub("A", "X", c(NA,"NA")) [1] "NX" "NX" # expected # [1] NA "NX" > sub("A", "X",
2005 Oct 28
3
splitting a character field in R
Dear R users, I have a dataframe with one character field, and I would like to create two new fields (columns) in my dataset, by spliting the existing character field into two using an existing substring. ... something that in SAS I could solve e.g. combining substr(which I am aware exist in R) and "index" for determining the position of the pattern within the string. e.g. if my
2010 Jan 12
1
parsing protocol of states
Dear R-users, actually i try to parse some state protocols for my work. i an easy stetting the code below works fine, if states are reached only once. in harder settings it could be possible that one state gets visited more times. in this case for me its interesting to see how much waiting time lies between to states on the whole. by the way i didn't use R as a parsing tool so far, so
2006 Aug 29
3
Substring and strsplit
Dear R People: I am trying to split a character vector into a set of individual letters: Ideal: x3 <- c("dog") "d" "o" "g" I tried the following: > strsplit(x3) Error in strsplit(x3) : argument "split" is missing, with no default > strsplit(x3,1) [[1]] [1] "dog" I know that this is incredibly simple, but what am I doing
2018 Jan 21
3
substr gives empty output
Dear all, I have a string, let's say "testing", and I would like to extract in sequence each letter (character) from it. But when I use substr() I only properly get the first character, the rest is empty (""). What am I getting wrong? For example, I have this code: >>> x <- "testing" k <- nchar(x) for (i in 1:k) { y <- substr(x, i, 1)
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
2004 Jun 01
1
converting text coordinates to decimal degrees
I receive GPS readings in a text string such as "0121.6723S 03643.6893E" and need the coordinates as decimal degrees in two separate variables: "-1.361205" and "36.728155". How do I do this in R? mikkel
2003 Jul 21
1
Inconsistent handling of character NA?
[R 1.7.1 on Windows XP Pro] Since R allows missing values for character variables, why are NA's not propagated by character manipulation functions? For example: > temp <- c("a", NA) > temp [1] "a" NA > is.na(temp) [1] FALSE TRUE > paste(temp[1], temp[2]) [1] "a NA" > substr(temp, 1, 1) [1] "a" "N" >