similar to: Argument recycling in substring()

Displaying 20 results from an estimated 10000 matches similar to: "Argument recycling in substring()"

2013 Dec 13
1
substring() and propagation of names
Hi, In R < 3.0.0, we used to get: > substring(c(A="abcdefghij", B="123456789"), 2, 6:2) A B A B A "bcdef" "2345" "bcd" "23" "b" But in R >= 3.0.0, we get: > substring(c(A="abcdefghij", B="123456789"), 2, 6:2) [1] "bcdef"
2008 May 06
1
substring
I have a data frame such as Name DISC1_5916 DABC2_789 ABCD_1234 I want to substring column Name so that DISC1 DABC2 ABCD ... Thanks. --------------------------------- [[elided Yahoo spam]] [[alternative HTML version deleted]]
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,
2010 Jul 21
3
String processing - is there a better way
I have a two part question Part 1) I am trying to remove characters in a string based on the position of a key character in another string.? I have a solution that works but it requires a for-loop.? A vectorized way of doing this has alluded me.? CleanRead<-function(x,y) { ? if (!is.character(x)) ??? x <- as.character(x) ? if (!is.character(y)) ??? y <- as.character(y) ?
2010 Oct 02
1
cleanup_pkg() in tools:::.build_packages() is broken
Hi, The cleanup_pkg() function defined the big tools:::.build_packages() function in tools/R/build.R is currently broken. When Makefiles are used cleanup_pkg() doesn't clean anything because of the way system2() is called. For example, the call to Ssystem() on line 304 (Ssystem is a silent version of system2) is basically trying to do this: >
2019 Feb 22
1
Bug: time complexity of substring is quadratic as string size and number of substrings increases
On 2/20/19 7:55 PM, Toby Hocking wrote: > Update: I have observed that stringi::stri_sub is linear time complexity, > and it computes the same thing as base::substring. figure > https://github.com/tdhock/namedCapture-article/blob/master/figure-substring-bug.png > source: > https://github.com/tdhock/namedCapture-article/blob/master/figure-substring-bug.R > > To me this is a
2019 Feb 20
2
Bug: time complexity of substring is quadratic as string size and number of substrings increases
Hi all, (and especially hi to Tomas Kalibera who accepted my patch sent yesterday) I believe that I have found another bug, this time in the substring function. The use case that I am concerned with is when there is a single (character scalar) text/subject, and many substrings to extract. For example substring("AAAA", 1:4, 1:4) or more generally, N=1000
2010 Jul 19
1
Help with replacing a substring in a string
Dear R Users, I am trying to replace a substring in a string with something else. For example: if we have "abc.degg.hijk" I would like to replace all the "." with a SPACE to become "abc degg hijk" I have tried the replace.substring.wild function in the Hmisc package but get this error: > replace.substring.wild("abc.degg.hijk","*.*","
2013 Jan 30
2
substring from behind
Hello together, i have a question for "substring". I know i can filter a number like this one: bill$No<-substring(bill$Customer,2,4) in this case i get the 2nd, 3rd and 4th number of my Customer ID. But how can i do this, if i want the 2nd, 3rd and 4th number of a column. Like this one. I have: Mercedes_02352 Audi_03555 and now i want to filter this data.frame to 235 355 can you
2010 Oct 25
2
Find index of a string inside a string?
Hi, I am searching for the equivalent of the function Index from SAS. In SAS: index("abcd", "bcd") will return 2 because bcd is located in the 2nd cell of the abcd string. The equivalent in R should do this: > myIndex <- foo("abcd", "bcd") #return 2. What is the function that I am looking for? I want to use the return value in substr, like I do
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()
2008 May 29
2
how to use substring match as condition?
Hi, How can I use a substring match as a condition in a subset command? Sth like this: subset(input, field1=="blah1" & field2=="blah2") # but now with substring match in field2 subset(input, field1=="blah1" & field3 *substringmatch* "blah3") I've tried with gsub, but it won't work: subset(input, field1=="blah1" &
2011 Feb 03
2
substring and paste character with a for loop
Hello R users, I have a little problem with a for loop. Below there is an simple example of my problem. I want to delet the commas in the character string. Fore this reason I create a for loop to unpick the string and rebuild him without the commas. The problem is, that "paste" does not work in the loop as I expected. text <- "aaa,bbb,ccc,ddd" characterseq <-
2010 Oct 29
1
list2env() is broken
Hi, The following code produces different kinds of problems depending on which platform you run it: x <- as.list(1:200000) names(x) <- paste("A", 1:200000, sep="") e <- list2env(x) Timeout on Linux, crash on Mac and Windows, with R 2.12.0 and current R devel. The "multi-assign" mode (i.e. when the 'envir' arg is supplied) doesn't seem
2007 May 31
0
Branch 'as' - 8 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_string.c libswfdec/swfdec_as_strings.c libswfdec/swfdec_as_types.c test/trace
libswfdec/swfdec_as_context.c | 20 + libswfdec/swfdec_as_interpret.c | 9 libswfdec/swfdec_as_string.c | 15 - libswfdec/swfdec_as_strings.c | 2 libswfdec/swfdec_as_types.c | 2 test/trace/Makefile.am | 28 + test/trace/isnan-5.swf |binary
2020 May 15
2
paste(character(0), collapse="", recycle0=FALSE) should be ""
Totally agree with that. H. On 5/15/20 10:34, William Dunlap via R-devel wrote: > I agree: paste(collapse="something", ...) should always return a single > character string, regardless of the value of recycle0. This would be > similar to when there are no non-NULL arguments to paste; collapse="." > gives a single empty string and collapse=NULL gives a zero long
2011 Feb 24
1
min/max of a vector with NAs and NaNs
I get this (with R-2.12 and R-2.13, didn't try with earlier versions): > max(c(NaN, NA)) [1] NA > max(c(NA, NaN)) [1] NaN I get the same thing with min(). The fact that the result of 'max(x)' or 'min(x)' depends on the order of the elements in 'x' is surprising. It also seems to contradict the man page: By definition the min/max of a numeric vector
2010 Nov 10
1
installed.packages Error: subscript out of bounds
Hi, Today we've seen the following problem with the R-2.12 that we use for our Windows builds: > installed.packages() Error: subscript out of bounds After some investigation we discovered that the cause of this failure was that 1 of the 890 packages currently installed on the machine (Windows Server 2003 R2) had its DESCRIPTION file empty:
2010 Oct 11
1
'R CMD build' not cleaning the src/ folder on Windows
Hi, 'R CMD build' (with R 2.12.0 RC) fails to clean the src/ folder on Windows: D:\biocbld\bbs-2.7-bioc>ls meat/BUS/src BUS.cpp BUS.h D:\biocbld\bbs-2.7-bioc>R\bin\R CMD build meat\BUS * checking for file 'meat\BUS/DESCRIPTION' ... OK * preparing 'BUS': * checking DESCRIPTION meta-information ... OK * cleaning src * installing the package
2007 Aug 07
2
Embedded nuls in strings
Hi, ?rawToChar 'rawToChar' converts raw bytes either to a single character string or a character vector of single bytes. (Note that a single character string could contain embedded nuls.) Allowing embedded nuls in a string might be an interesting experiment but it seems to cause some troubles to most of the string manipulation functions. A string with an embedded 0: