[R] suggestion of regex pattern

Boris Steipe boris.steipe at utoronto.ca
Sat Apr 18 19:30:47 CEST 2015


Sorry - it's not entirely clear to me what you need to do.

See here for some hints on how to ask questions on this list. I'm sure we'll be able to help quickly.
http://adv-r.had.co.nz/Reproducibility.html
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
(and don't post in HTML   :-)


B.

On Apr 18, 2015, at 11:10 AM, Fernando Gama <f.fabiogama88 at gmail.com> wrote:

> Hello Boris,
> 
> thanks for your response. 
> 
> So, firstly considered that  i've been input a set of serches strings (.txt format) and i'm using regex to transform in a suitable  format to my script. This part is a final part of my code and i wish putting in input to a subset.
> 
> (.txt formatted)
> 
> ---- STRINGS (INPUT)
>  
> [1]  "municipio =='Limeira' "
> [2]  "municipio =='Limeira' & mesincident =='marco' "
> [3]  "​municipio =='Limeira' & mesincident =='marco' & trechoklmetros > 1.00 12.300"
> ...
> ..
> ..
> ..
> [n] "......"
> 
> --------------
> 
> desired_fomart <- ​it will reveice all strings to filter in a dataset by subset below:
> 
> 
> a loop each line:
> 
> subset(dataset_read, desired_fomart[i])
> 
> My question: taking into consideration this cenario, in your oppinion your reply is my suitable for my problem, whereas i will to map each value in database?
> 
> Once again, thank so much! :)
> 
> 2015-04-18 11:04 GMT-03:00 Boris Steipe <boris.steipe at utoronto.ca>:
> This is not a regular expression but simply a conjunction (sequence of '&') of logical expressions. Moreover it's not wrong. Consider:
> 
> xyz <- data.frame(municipio = c('Limeira'), mesincident = c('marco'), trechoklmetros = c(3.00, -4.00, 30))
> xyz
> 
>   municipio mesincident trechoklmetros
> 1   Limeira       marco              3
> 2   Limeira       marco             -4
> 3   Limeira       marco             30
> 
> 
> xyz$municipio =='Limeira' & xyz$mesincident =='marco' & xyz$trechoklmetros > 1.00
> [1]  TRUE FALSE  TRUE
> 
> xyz$municipio =='Limeira' & xyz$mesincident =='marco' & xyz$trechoklmetros > 1.00 & xyz$trechoklmetros <= 12.3
> [1]  TRUE FALSE FALSE
> 
> 
> If there's a problem it seems to be elsewhere.
> Cheers,
> Boris
> 
> 
> On Apr 17, 2015, at 4:22 PM, Fernando Gama <f.fabiogama88 at gmail.com> wrote:
> 
> > Hello,
> >
> > I have benn problems to construct the pattern for this:
> >
> > municipio =='Limeira' & mesincident =='marco' & trechoklmetros > 1.00 12.300
> >
> > I would like:
> >
> > municipio =='Limeira' & mesincident =='marco' & trechoklmetros > 1.00
> > *& **trechoklmetros
> > <= *12.300
> > ​
> > ​Any suggestion?​
> >
> >
> > --
> > Att,
> >
> > Fernando Gama da Mata
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> 
> -- 
> Att,
> 
> Fernando Gama da Mata
> 
> 



More information about the R-help mailing list