Displaying 20 results from an estimated 10000 matches similar to: "Regex to remove last character"
2011 Mar 18
1
Replace split with regex for speed ?
Have timestamp in format HH:MM:SS.MMM.UUU and need to remove the last "." so
it is in format HH:MM:SS.MMMUUU.
What is the fastest way to do this, since it has to be repeated on millions
of rows. Should I use regex ?
Currently doing it with a string split, which is slow:
>head(ts)
[1] 09:30:00.000.245 09:30:00.000.256 09:30:00.000.633 09:30:00.001.309
09:30:00.003.635
2011 Mar 04
4
xts POSIXct index format
Hi,
I cannot figure out how to change the index format when displaying POSIXct
objects.
Would like the xts index to display as %H:%M:%OS3 when doing viewing the xts
object.
Think I am missing the obvious.
Cheers,
Chris
--
View this message in context: http://r.789695.n4.nabble.com/xts-POSIXct-index-format-tp3336136p3336136.html
Sent from the R help mailing list archive at Nabble.com.
2011 Jan 04
1
XTS : merge.xts seems to have problem with character vectors
Hi,
Please can you tell me what I am doing wrong. When trying to merge two xts
objects, one of which has multiple character vectors for columns...I am just
getting NAs.
> str(t)
POSIXct[1:1], format: "2011-01-04 11:45:37"
> y2 = xts(matrix(c(letters[1:10]),5), order.by=as.POSIXct(c(t + 1:5)))
> names(y2) = c(1,2)
> y2
1 2
2011-01-04 11:45:38
2011 Jan 10
2
Aggragating subsets of data in larger vector with sapply
Have 40,000 rows of buy/sell trade data and am trying to add up the buys for
each second, the code works but it is very slow. Any suggestions how to
improve the sapply function ?
secEP = endpoints(xSym$Direction, "secs") # vector of last second on an XTS
timeseries object with multiple entries for each second.
d = xSym$Direction
s = xSym$Size
buySize = sapply(1:(length(secEP)-1),
2010 Oct 11
2
Slow reading multiple tick data files into list of dataframes
Hi,
I am trying to find the best way to read 85 tick data files of format:
> head(nbbo)
1 bid CON 09:30:00.722 09:30:00.722 32.71 98
2 ask CON 09:30:00.782 09:30:00.810 33.14 300
3 ask CON 09:30:00.809 09:30:00.810 33.14 414
4 bid CON 09:30:00.783 09:30:00.810 33.06 200
Each file has between 100,000 to 300,300 rows.
Currently doing nbbo.list<-
2011 Mar 02
1
Create a zoo/xts Time Series with Millisecond jumps
Is there a easy way to create the time index for a zoo/xts object for every
100 milliseconds.
eg. time Index would be:
10:00:00:100
10:00:00:200
10:00:00:300
10:00:00:400
I am looking to build an empty zoo/xts object with time index from 10am to
3pm, index jumps by 100ms each row.
Thanks,
Chris
--
View this message in context:
2009 Dec 01
2
Cut intervals (character) to numeric midpoint; regex problem
Starting with the head of a 499 element matrix whose column names are
now the labels trom a cut() operation, I needed to get to a vector of
midpoints to serve as the basis for plotting a calibration curve
( exp(linear predictor) vs. :
> dput(head(dimnames(mtcal)[2][[1]])) # was starting point
testvec <- c("(-8.616,-3.084]", "(-3.084,-2.876]",
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
2008 Jun 13
1
Regex for Special Characters under Grep
Hi all,
I am trying to capture lines of a file that DO NOT
start with the following header: !, #, ^
But somehow my regex used under grep doesn't
work.
Please advice what's wrong with my code below.
__BEGIN__
in_fname <- paste("mydata.txt,".soft",sep="")
data_for_R <- paste("data_for_R/", args[3], ".softR", sep="")
# my regex
2009 Jun 08
1
Regex question to find a string that contains 5-9 alpha-numeric characters, at least one of which is a number
Hi,
This is not exactly an R question but I am trying to use gsub to replace
a string that contains 5-9 alpha-numeric characters, at least one of
which is a number. Is there a good way to write it in a one line regex?
Thanks,
Richard
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,
2007 Nov 24
2
Sieve regex never matches
Hi,
I found the following code on the net which should redirect all mails
to another address depending on the time of day (useful for forwarding
mails to work):
require ["regex"];
if allof (header :regex "date" "(08|09|10|11|12|13|14|15|16|17):..:..",
not header :regex "date" "(sat|sun)") {
redirect "address at
2015 Nov 05
3
How to encode plus sign in REGEX function in dialplan?
Dear all,
I have made a fairly complex dialplan where I am using the REGEX function in many places. This works so far, but I wasn't able to solve the following problem. What I would like to do is the following (please note that this is normal regex syntax and obviously not what the REGEX function expects, but I hope it shows the idea):
same => n(A1), GotoIf($[${REGEX("^\+49.*"
2015 Nov 09
2
How to encode plus sign in REGEX function in dialplan?
On 06.11.2015 14:06, Rusty Newton wrote:
>
> It should be able to handle typical regular expression. I don't see
> anything wrong with what you are doing. Please file a bug at
> issues.asterisk.org/jira. Do include a debug log on the issue
> captured when Asterisk attempts to execute these extensions.
>
>
2008 Oct 15
4
strsplit and regex
Hi All,
Is there a means to extract the "10" from "23:10:34" in one pass using
strsplit (or something else)?
tst <- "23:10:34"
For example my attempt
strsplit(as.character(tst),"^[0-9]*:")
gives
[[1]]
[1] "" "" "34"
Obviously it is matching the first two instances of [0-9]. Note that
there may be only one digit
2006 May 16
2
Using REGEX function
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Arial">Greetings,<br>
<br>
I'm running
2007 Aug 02
1
dovecot 1.0.2, sieve 1.0.2 and regex
I've just ported a largeish procmail script across to sieve and want to
get to use wildcards in filing mail and can't seem to get regex to work.
The script starts nicely with:
> require ["fileinto","regex","envelope","vacation","regex"];
and a bit down these few lines comes into play:
> elsif header :regex "From"
2009 May 11
1
Sieve & Regex
Hi all
I'm trying to create a new sieve rule.
What I would like to do is catch "From" addresses that
are equal to the rightpart (hostname) of a message-id.
For example:
Message-ID: <000d01c9d23a$941a7db0$6400a8c0 at upwabm>
From: "Leanne Crabtree" <upwabm at blomberg-co.com>
I would like to catch this mail, because it has
"upwabm" on the right part
2009 Feb 02
1
sieve 0.1.2 problem with address and :regex
I'm getting a core dump with the following script:
require [ "fileinto", "regex", "variables" ];
if address :domain :regex ["Reply-To", "Sender", "To", "Cc"]
"antlr.org|mailman.unixodbc.org|research.att.com|wireshark.org" {
if address :regex ["Reply-To", "Sender", "To",
2012 Apr 26
2
Using backreferences from node name regex match
I appears that backreferences when using regexes in node names doesn''t
work. Can anyone confirm this? If I''m incorrect, how do I go about using a
backreference to the name regex within the node definition container?
Thanks,
Guy
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web