Re: [R] Grep Help

2016-02-22 Thread Boris Steipe
I see numerous backticks in your code, not quotes. "`" and "'" are not the same. Backticks are not string delimiters. As for valid names: look at the help page for make.names(). HTH, Boris On Feb 22, 2016, at 1:32 PM, Burhan ul haq wrote: > Hi, > > # 1) I have read in a CSV file > > df =

[R] Grep Help

2016-02-22 Thread Burhan ul haq
Hi, # 1) I have read in a CSV file df = read.csv(file="GiftCards - v1.csv",stringsAsFactors=FALSE) head(df) str(df) # 2) converted to a tbl_df df2 = tbl_df(df) # 3) fixed the names to remove leading "X" character n = names(df2) n2 = gsub(pattern="^\\w","\\1",n) names(df2) = n2 # 4) somehow the

Re: [R] grep help (character ommission)

2013-05-01 Thread arun
r-h...@stat.math.ethz.ch Cc: Sent: Wednesday, May 1, 2013 4:37 AM Subject: [R] grep help (character ommission) Hello, Banging my head against a wall here ... can anyone light the way to a pattern modification that would make the following TRUE? identical(   grep(     "^Intensity\\s[^HL]&qu

Re: [R] grep help (character ommission)

2013-05-01 Thread Rui Barradas
Hello, The following pattern seems to do it. grep("^Intensity$|^Intensity\\s[^HL]", c("Intensity","Intensity L", "Intensity H", "Intensity Rep1")) Hope this helps, Rui Barradas Em 01-05-2013 09:37, Johannes Graumann escreveu: Hello, Banging my head against a wall here ... can anyone li

Re: [R] grep help (character ommission)

2013-05-01 Thread jim holtman
try this: > identical( + grep( + "^Intensity *[HL]", + c("Intensity","Intensity L", "Intensity H", "Intensity Rep1"), + invert = TRUE), + as.integer(c(1,4))) [1] TRUE > On Wed, May 1, 2013 at 4:37 AM, Johannes Graumann wrote: > Hello, > > Banging my head against a wall here ...

[R] grep help (character ommission)

2013-05-01 Thread Johannes Graumann
Hello, Banging my head against a wall here ... can anyone light the way to a pattern modification that would make the following TRUE? identical( grep( "^Intensity\\s[^HL]", c("Intensity","Intensity L", "Intensity H", "Intensity Rep1")), as.integer(c(1,4))) Thank you for your time.