similar to: if exists with regex return

Displaying 20 results from an estimated 20000 matches similar to: "if exists with regex return"

2012 Aug 27
4
?nchar ?strsplit
Hi, my data frame is x<-data.frame(ID=c("abc/def","abc/def/ghi","abc","mno/pqr/st/ab")) I want to split my column ID using "/" as the place to split. How can I do that without telling the code how many sub-columns. I could use nchar(gsub("[^/]","",x$ID)) to get how many "/" are in each row of the column, but could
2004 Dec 02
2
regex to match word boundaries
Can someone verify whether or not this is a bug. When I substitute all occurrence of "\\B" with "X" R seems to correctly place an X at all non-word boundaries (whether or not I specify perl) but "\\b" does not seem to act on all complement positions: > gsub("\\b", "X", "abc def") # nothing done [1] "abc def" >
2005 Jun 09
3
dir() and RegEx and gsub()
Dear R-Users, I have two questions: a) in a directory there are 3 files: [1] "Data.~csv" "Kopie von Data.~csv" "VorlageTradefile.csv" The command "dir( fold, pattern = "\.csv" )" gives back *all* the 3 files With dir( fold, pattern = "\\.csv" ) I get back only VorlageTradefile.csv. I don't understand this behaviour,
2009 Jan 18
8
regex -> negate a word
Dear all, let's assume I have a vector of character strings: x <- c("abcdef", "defabc", "qwerty") What I would like to find is the following: all elements where the word 'abc' does not appear (i.e. 3 in this case of 'x'). Since I am not really experienced with regular expressions, I started slowly and thought I find all word were
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
2010 Jun 30
2
string question
Hi, How can I get double quotes embedded in the string? Example: -------------- str1 <- '"xyz"' ## desired output # abc"xyz" qr2 <- paste('abc',str1,sep='') print(qr2) ----------------- Actual output: > [1] "abc\"str\"" I also tried putting an escape sequence before the quote, but couldn't get the string that I
2008 Jul 09
2
gsub and "\"
This is hopefully a simple question. I am trying to escape single quotes like so: abc's >> abc\'s However, I cannot find an easy way to do that with gsub: gsub("'","\\\\'","abc's") # returns "abc\\'s" How can I get a single \ in the output? Thanks, Sean
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,
2008 Jun 12
2
Request for added functionality - tracking and blocking attacks
Somebody please forward this, if this is not an appropiate place to ask the OpenSSH developers for a new feature. As many of us have seen, any sshd left open on the internet eventually becomes the target of password guessing attacks. I am aware of tools for scanning the security logs, and manipulating iptables to block ongoing attacks, but I am not aware of a way to configure sshd itself to
2010 Jul 14
4
reverse string
Dear all, Are there any functions in R to reverse the order of the string. smth like reverse("abc") to get "cba"? Thanks a lot. [[alternative HTML version deleted]]
2024 Jun 09
2
Member server: Failed to join domain: failed to find DC for
Agree. But I don?t think it is. See: root at member:/# cat /etc/hostname member root at member:/# cat /etc/hosts 127.0.0.1 localhost 192.168.3.1 member.mad.mater.int member root at member:/# cat /etc/resolv.conf search mad.mater.int nameserver 192.168.0.12 -> DC1 nameserver 192.168.0.13 -> DC2 nameserver 192.168.0.14 -> DC3 nameserver 192.168.0.62 -> DC4 root at member:/# cat
2000 Mar 08
2
possible BUG with as.data.frame() and/or [.data.frame
Here is a possible BUG with as.data.frame() and/or [.data.frame which broke Michael Lapsleys RODBC-Code. Can anyone confirm it is a bug or a 'feature' of the prototype? tablename <- "abc" a <- as.data.frame(cbind("abc", 1:3)) b <- as.data.frame(cbind(tablename, 1:3)) # ok > a V1 V2 1 abc 1 2 abc 2 3 abc 3 # missing column name > b tablename 1
2008 Dec 12
7
character count
Dear list, I have a variable that consists of typed responses. I wish to compute a variable equal to the number of characters in the original variable. For example: > x <- c("convert this to 32 because it has 32 characters", "this one has 22 characters", "12 characters") [Some magic function here] > x [1] 32 22 12 Any ideas?
2018 Sep 19
5
segfault issue with parallel::mclapply and download.file() on Mac OS X
I have an lapply function call that I want to parallelize. Below is a very simplified version of the code: url_base <- "https://cloud.r-project.org/src/contrib/" files <- c("A3_1.0.0.tar.gz", "ABC.RAP_0.9.0.tar.gz") res <- parallel::mclapply(files, function(s) download.file(paste0(url_base, s), s)) Instead of download a couple of files in parallel, I get a
2012 Sep 14
1
please comment on my function
this function is supposed to canonicalize the language: --8<---------------cut here---------------start------------->8--- canonicalize.language <- function (s) { s <- tolower(s) long <- nchar(s) == 5 s[long] <- sub("^([a-z]{2})[-_][a-z]{2}$","\\1",s[long]) s[nchar(s) != 2 & s != "c"] <- "unknown" s }
2024 Jun 09
1
Member server: Failed to join domain: failed to find DC for
On Sat, 8 Jun 2024 18:07:55 +0100 Luis Peromarta <lperoma at icloud.com> wrote: > > LP > On Jun 8, 2024 at 17:56 +0100, samba at lists.samba.org > <samba at lists.samba.org>, wrote: > > > > I have never run those commands like that, I normally run 'net ads > > join -Uadministrator' or 'net ads leave -Uadministrator', I have > >
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
2000 Jan 31
1
long character data
Hi, When trying to generate very long strings, my R hangs without any error message, even if given much memory. # e.g. x <- character(10) for (i in 1:10) x[i] <- paste(1:1000, collapse="abc") paste(x, collapse="") # or directly paste(1:10000, collapse="abc") Am I violating any max(nchar(character())) or is this a bug? Regards Jens Oehlschl?gel-Akiyoshi
2006 Jun 06
2
about string
Hello sir: There are 2 questions about string. 1 How to calculate the width of a string? e.g string "abc"'s width is 3; 2 How can I get the "substring" in such kind of condition: "f:\\JPCS_signal.txt" "f:\\PC1_signal.txt" "f:\\PC2_signal.txt" What I wanna get is "JPCS" "PC1" "PC2".How can I achieve them by R
2011 Dec 01
2
Counting the occurences of a charater within a string
I am new to R but am experienced SAS user and I was hoping to get some help on counting the occurrences of a character within a string at a row level. My dataframe, x, is structured as below: Col1 abc/def ghi/jkl/mno I found this code on the board but it counts all occurrences of "/" in the dataframe. chr.pos <- which(unlist(strsplit(x,NULL))=='/') chr.count <-