similar to: Regular expression help

Displaying 20 results from an estimated 10000 matches similar to: "Regular expression help"

2017 Oct 10
0
Regular expression help
How about this (I'm showing it as a pipe because it's easier to read that way): library(magrittr) "f 147/1315/587 2820/1320/587 3624/1321/587 1852/1322/587" %>% ? strsplit(' ') %>% ? unlist %>% ? sub('^[^/]*/*','',.) %>% ? sub('^[^/]*/*','',.) %>% ? paste(collapse = ' ') Georges Monette -- Georges Monette,
2017 Oct 09
0
Regular expression help
Hi Duncan, why not split on / and take the correct elements? It is not as elegant as regex but could do the trick. Best, Ulrik On Mon, 9 Oct 2017 at 17:03 Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > I have a file containing "words" like > > > a > > a/b > > a/b/c > > where there may be multiple words on a line (separated by spaces). The
2017 Oct 09
0
Regular expression help
> x <- "f 147/1315/587 2820/1320/587 3624/1321/587 1852/1322/587" > gsub("(^| *)([^/ ]*/?){0,2}", "\\1", x) [1] " 587 587 587 587" > y <- "aa aa/ aa/bb aa/bb/ aa/bb/cc aa/bb/cc/ aa/bb/cc/dd aa/bb/cc/dd/" > gsub("(^| *)([^/ ]*/?){0,2}", "\\1", y) [1] " cc cc/ cc/dd cc/dd/" Bill Dunlap TIBCO
2017 Oct 09
1
Regular expression help
"(^| +)([^/ ]*/?){0,2}", with the first "*" replaced by "+" would be a bit better. Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Oct 9, 2017 at 8:50 AM, William Dunlap <wdunlap at tibco.com> wrote: > > x <- "f 147/1315/587 2820/1320/587 3624/1321/587 1852/1322/587" > > gsub("(^| *)([^/ ]*/?){0,2}", "\\1", x)
2016 Apr 09
1
assign
Hi, I couldn't resist these two suggestions: strings <- c("ASk/20005-01-45/90", "Alldatk/25-17-4567/990") x <- as.numeric(gsub("^[^-]*-|-.*$","",strings)) or x <- as.numeric(sub("^[^-]*-([0-9]+)-.*$","\\1",strings)) Best, Georges --------------------- Georges Monette, York University, Toronto On 08/04/2016 10:53 PM,
2016 Apr 09
0
assign
Dear Val, Your question isn't entirely clear (to me), but this is what I think you want to do: ------------------ snip ---------------- > strings <- c("ASk/20005-01-45/90", "Alldatk/25-17-4567/990") > location <- regexpr("-[0-9]*", strings) > x [1] "01" "17" > x <- substring(strings, location + 1, location +
2016 Apr 09
3
assign
Hi all I am trying t extract a variable from a column ASk/20005-01-45/90 Alldatk/25-17-4567/990 I want to assign a variable to the numbers coming the first"-" x=01 for the first and x=17 for teh second I tried using gsub but did not work x=gsub("-") any help? [[alternative HTML version deleted]]
2008 Oct 29
2
sessionInfo() error
[Using R 2.7.2 on Windows XP] After re-building our heplots package, I've begun to get the following error from sessionInfo(), even though it passes R CMD check and builds without errors: > sessionInfo() Error in x$Priority : $ operator is invalid for atomic vectors In addition: Warning message: In FUN(c("MASS", "heplots", "car", "rgl",
2002 Apr 08
2
user coordinates and rug plots in lattice graphics
Dear R list members, I'd like to produce rug plots at the bottom of panels in a trellis display (using the lattice package), but par("usr") doesn't return user coordinates for panels, and consequently rug fails, as the following example (suggested to me by Georges Monette) illustrates: > x <- rnorm(50) > y <- rnorm(50) > f <-
2003 Jun 21
2
Beginner's Question on Linear Regression Models
Hi Folks, Could anyone point me to a good reference on linear regression models? Specifically, I am trying to gain an intuitive feel for how the standard error values are calculated for the parameter estimates. My understanding is that these are computed using the variance-covariance matrix computed from the input data matrix. Although I think I understand the math, I still don't have a
2006 Aug 03
2
Connectiion to UPS via SNMP
Hi NUT-Users, we work with a GE LP 33 UPS and an Advanced SNMP WEB Interface Card. This card supports the RFC1628 Definition. So I think this combination work together with NUT and the snmp-driver, correct? I installed the networkupstools on my Debian Sarge with apt-get (nut & nut-snmp). After configuration I start the upsd and upsmon. I get following output in /var/log/syslog: ... Aug 3
2013 Sep 19
1
Vignette problem and CRAN policies
Hello, All: The vignette with the sos package used "upquote.sty", required for R Journal when it was published in 2009. Current CRAN policy disallows "upquote.sty", and I've so far not found a way to pass "R CMD check" with sos without upquote.sty. I changed sos.Rnw per an email exchange with Prof. Ripley without solving the problem; see below. The
2005 Feb 08
3
logistic regression
Hi, I'm using glm function to do logistic regression and now I want to know if it exists a kind of R-squared with this function in order to check the model. Thank you.
2010 Apr 29
9
illegal root login on `hvc0''
Hi, I''m running Xen 4 on Slack64. I haven''t console login prompt to domU until I changed xvc0 to hvc0 on /etc/inittab file. No I have access to login but whenever I try to login I get this error from /var/adm/secure file root@darkstar:/var/adm# cat secure Apr 28 22:49:22 darkstar login[1286]: ILLEGAL ROOT LOGIN on `hvc0'' Apr 28 22:49:45 darkstar last message repeated
2011 Apr 07
1
Two questions about metacharacter in regexprs and function return
for the script, please kindly see the script below. At line 10 and line 13, my problems occurs. The first one is I try to retrieve the gene official name from a column of a table. The pattern of official name is something starting with gene_name. For detail problems, please see the according lines. Any suggestions are appreciated example of matching source (extract the Nnat, sometime it would
2008 Nov 17
1
CITATION file with multiple citEntry(): no BibTeX produced by citation()
[Using R 2.8.0 / Win XP / ] I just added a CITATION file to the heplots package--- appended below. From the document ion for ?CITATION, there can be *one or more* calls to citEntry() within the CITATION file, and each should produce an object of class "citation". With just a single citEntry(), citation produces the expected output, with BibTeX entry: >
2013 May 03
2
Find the flow data from its accumulation of the panel data
Hi, I have the panel data of income statement of several banks. The date 9803 means 1998-Q1, 9806 means 1998-Q2, etc. I transform the date code to 1 (for 1998Q1), 2 (for 1998Q2), ...., 16 (for 2011Q4) where 1, 2, .... are placed in Col1. Now the income statement of a specific quarter is actually the accumulation from the beginning of the year. For example, the cost data of 1999Q3 is the
2007 Jul 17
4
[R-sig-DB] RODBC on Oracle DB
essai <- odbcConnect("ORESTE_prod", uid="osis_r", pwd="12miss15" ,case="oracle") > sqlTables(essai)$ORESTE ... 1315 <NA> ORESTE S_PROFESSIONS_OLD TABLE <NA> 1316 <NA> ORESTE S_PROVENANCES TABLE <NA> 1317 <NA> ORESTE
2009 Jan 28
1
Scope of variable
I have this extension: exten => 1322,1,Answer() exten => 1322,n,Set(CfMC_AMDValue="NotChecked") exten => 1322,n,GotoIf($["${CfMC_DoAMD}" != "Yes"]?NOAMD) exten => 1322,n,AMD() exten => 1322,n,Set(CfMC_AMDValue = ${AMDSTATUS}) exten => 1322,n(NOAMD),Wait(1) exten => 1322,n,UserEvent(E1322-1,${CfMC_ActionID}=${CHANNEL} & ${CfMC_AgentToUse}
2001 Nov 21
1
Slow printing in batch?
For doumentation purposes I run a batch R program that does reshaping etc. of data and finally prints things. When I paste the code into an R-window everything runs in a few seconds, but in Batch mode i get in the output file the result below. Any clues why R uses 4 min to print a 1129\times 6 dataframe in batch mode? The scrit I use to run R is: c:\stat\r\%R_VERS%\bin\Rterm --no-restore