similar to: Help with Regular expression

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

2013 Jan 15
2
Regular expression
Hello again, I am having a problem on Regular expression. Let say I have following code: > gsub("[',]", "", "'asd'f") [1] "asdf" This is perfect. However I am having problem if I include "" (i.e. the double quote) in the first argument as the pattern search: > gsub("[',"]", "",
2018 Jan 04
2
format integer numbers with leading 0
Dear R-er, I would like format integer number as characters with leading 0 for a fixed width, for example: 1 shoud be "01" 2 shoud be "02" 20 should be "20" Now I use: x <- c(1, 2, 20) gsub(" ", "0", format(x, width=2)) But I suspect more elegant way could be done directly with format options, but I don't find. Thanks a lot Marc
2011 Mar 19
3
[O/T] reference for regular expressions
Dear R People: Could someone recommend a good reference on regular expressions, please? Thanks in advance, Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodgess at gmail.com
2017 Aug 02
4
Extracting numeric part from a string
Hi again, I am struggling to extract the number part from below string : "\"cm_ffm\":\"563.77\"" Basically, I need to extract 563.77 from above. The underlying number can be a whole number, and there could be comma separator as well. So far I tried below : > library(stringr) > str_extract("\"cm_ffm\":\"563.77\"",
2013 Mar 28
4
How to replace '$' sign?
Hello again, I want to remove "$" sign and replace with nothing in my text. Therefore I used following code: > gsub("$|,", "", "$232,685.35436") [1] "$232685.35436" However I could not remove '$' sign. Can somebody help me why is it so? Thanks and regards
2017 Jun 11
3
post ino64: lockd no runs?
On Sun, Jun 04, 2017 at 08:57:44AM -0400, Michael Butler wrote: > It seems that {rpc.}lockd no longer runs after the ino64 changes on any > of my systems after a full rebuild of src and ports. No log entries > offer any insight as to why :-( > > imb I don't tend to use NFS on my systems that are running head, so I haven't had occasion to test this as stated. However, I
2013 Mar 23
4
Converting a character vector to numeric
Hello again, Let say I have following vector: Vec <- c("0.0365780769", "(1.09738648244378)", "(0.812507787221523)", "0.5778069963", "(0.452456601362355)", "-1.8900812605", "-1.8716093762", "0.0055217041", "-0.4769192333", "-2.4133018880") Now I want to convert this vector to numeric vector. I
2017 Nov 01
1
Correct subsetting in R
But they row.names() cannot give me the IDs On Wednesday, November 1, 2017 9:45 AM, David Wolfskill <r at catwhisker.org> wrote: On Wed, Nov 01, 2017 at 04:13:42PM +0000, Elahe chalabi via R-help wrote: > Hi all, > I have two data frames that one of them does not have the column ID: > > > str(data) > 'data.frame': 499 obs. of 608 variables:
2017 Jul 18
4
Creating/Reading a complex string in R
Thanks for your pointer. Is there any way in R how to replace " ' " with " /' " programmatically? My actual string is quite lengthy, so changing it manually may not be possible. I am aware of gsub() function, however not sure I can apply it directly on my original string. Regards, On Tue, Jul 18, 2017 at 10:27 PM, John McKown <john.archie.mckown at gmail.com>
2018 Mar 04
3
Change Function based on ifelse() condtion
Below is my full implementation (tried to make it simple as for demonstration) Lapply_me = function(X = X, FUN = FUN, Apply_MC = FALSE, ...) { if (Apply_MC) { return(mclapply(X, FUN, ...)) } else { if (any(names(list(...)) == 'mc.cores')) { myList = list(...)[!names(list(...)) %in% 'mc.cores'] } return(lapply(X, FUN, myList)) } } Lapply_me(as.list(1:4), function(xx) { if (xx ==
2011 Feb 14
2
Is there a way to force counters to be treated as "unsigned?"
I am acquiring some sampled data that is time-stamped (with a POSIXct). Some of the data is in the form of "counters" -- that is, what is interesting isn't value of a given counter at a given time, but the change in the counter from one sample to a later one. As the counters are only incremented, they would be perceived to be monotonically increasing -- ideally. Unfortunately, the
2010 Jul 10
7
Need help on date calculation
Hi all, please see my code: > library(zoo) > a <- as.yearmon("March-2010", "%B-%Y") > b <- as.yearmon("May-2010", "%B-%Y") > > nn <- (b-a)*12 # number of months in between them > nn [1] 2 > as.integer(nn) [1] 1 What is the correct way to find the number of months between "a" and "b", still
2018 Mar 04
0
Change Function based on ifelse() condtion
The reason that it works for Apply_MC=TRUE is that in that case you call mclapply(X,FUN,...) and the mclapply() function strips off the mc.cores argument from the "..." list before calling FUN, so FUN is being called with zero arguments, exactly as it is declared. A quick workaround is to change the line Lapply_me(as.list(1:4), function(xx) { to Lapply_me(as.list(1:4),
2018 Mar 04
2
Change Function based on ifelse() condtion
My modified function looks below : Lapply_me = function(X = X, FUN = FUN, Apply_MC = FALSE, ...) { if (Apply_MC) { return(mclapply(X, FUN, ...)) } else { if (any(names(list(...)) == 'mc.cores')) { myList = list(...)[!names(list(...)) %in% 'mc.cores'] } return(lapply(X, FUN, myList)) } } Here, I am not passing ... anymore rather passing myList On Sun, Mar 4, 2018 at 10:37 PM,
2018 Mar 04
2
Change Function based on ifelse() condtion
@Eric - with this approach I am getting below error : Error in FUN(X[[i]], ...) : unused argument (list()) On Sun, Mar 4, 2018 at 10:18 PM, Eric Berger <ericjberger at gmail.com> wrote: > Hi Christofer, > You cannot assign to list(...). You can do the following > > myList <- list(...)[!names(list(...)) %in% 'mc.cores'] > > HTH, > Eric > > On Sun, Mar
2003 Sep 28
4
make world
Hi, I was under the impression a successful make world was updating include files in /usr/include/netinet too. When I have a good make world, the files in /usr/include have new time stamps, but the ones in netinet have not! Am I missing something here? My current stable doesn't compille properly it fails in kdump on a missing ioctlcmd_t typedef. Peter
2012 Dec 14
5
A question on list and lapply
Dear all, let say I have following list: Dat <- vector("list", length = 26) names(Dat) <- LETTERS My_Function <- function(x) return(rnorm(5)) Dat1 <- lapply(Dat, My_Function) However I want to apply my function 'My_Function' for all elements of 'Dat' except the elements having 'names(Dat) == "P"'. Here I have specified the name
2012 Mar 16
4
How to start R in maximized size???
Dear all, when I start R, I want that the console window should be in the Maximized size automatically. Can somebody help me how to achieve that? Thanks and regards,
2018 Mar 04
0
Change Function based on ifelse() condtion
That's fine. The issue is how you called Lapply_me(). What did you pass as the argument to FUN? And if you did not pass anything that how is FUN declared? You have not shown that in your email. On Sun, Mar 4, 2018 at 7:11 PM, Christofer Bogaso < bogaso.christofer at gmail.com> wrote: > My modified function looks below : > > Lapply_me = function(X = X, FUN = FUN, Apply_MC =
2005 Sep 22
2
Tunnel-only SSH keys
Hello. I once read somewhere that it's possible to limit SSH pubkeys to 'tunnel-only'. I can't seem to find any information about this in any of the usual places. I'm going to be deploying a few servers in a couple of days and I'd like them to log to a central server over an SSH tunnel (using syslog-ng) however I'd like to prevent actual logins (hence