Re: [R] looking for a string

2008-04-16 Thread [Ricardo Rodriguez] Your XEN ICT Team
Mark Leeds wrote: > Hi Ricardo: I'm glad it helped but check > > regexpr("Jalapa", as.character( unidad ) ) != -1 > > because I think it should be > > regexpr("Jalapa", as.character( DF$unidad ) ) != -1 > > if unidad is a column of DF. Checked! attach(DF) did the trick! :-) Greetings, Ricardo

Re: [R] looking for a string

2008-04-16 Thread [Ricardo Rodriguez] Your XEN ICT Team
Charles C. Berry wrote: > > Like this: > > conaguaMexicoSub <- subset(conagua, > regexpr("Jalapa", as.character( unidad ) ) != -1 > select = c(equipo,X101:X309)) > > But it looks like you have to sort out some issues concerning dueling > locales first. > > Chuck > > > Far clear! Thanks

Re: [R] looking for a string

2008-04-16 Thread [Ricardo Rodriguez] Your XEN ICT Team
Thanks Mark! Mark Leeds wrote: > Hi Ricardo: you can look at ?regexpr but I'm pretty sure that below returns > a vector of TRUES and FALSES depending on whether the condition ( is Jalapa > contained in unidad ) is TRUE. So, wherever the vector is TRUE is where > Jalapa was contained in unidad. So,

Re: [R] looking for a string

2008-04-15 Thread Charles C. Berry
On Tue, 15 Apr 2008, [Ricardo Rodriguez] Your XEN ICT Team wrote: Charles C. Berry wrote: You want ?regexpr Something like regexpr("Jalapa", as.character( unidad ) ) != -1 HTH, Chuck Please, look at this... > substringJalapa <- regexpr("Jalapa", as.character(conagua$unidad ) )

Re: [R] looking for a string

2008-04-15 Thread [Ricardo Rodriguez] Your XEN ICT Team
Thanks Mark! [EMAIL PROTECTED] wrote: >> From: "[Ricardo Rodriguez] Your XEN ICT Team" <[EMAIL PROTECTED]> >> Date: 2008/04/15 Tue PM 04:48:12 CDT >> To: [EMAIL PROTECTED], r-help@r-project.org >> Subject: Re: [R] looking for a string >> > >

Re: [R] looking for a string

2008-04-15 Thread [Ricardo Rodriguez] Your XEN ICT Team
Thanks all, [EMAIL PROTECTED] wrote: >> From: "[Ricardo Rodriguez] Your XEN ICT Team" <[EMAIL PROTECTED]> >> Date: 2008/04/14 Mon PM 07:43:23 CDT >> To: Henrique Dallazuanna <[EMAIL PROTECTED]>, r-help@r-project.org >> Subject: Re: [R] looking for

Re: [R] looking for a string

2008-04-14 Thread [Ricardo Rodriguez] Your XEN ICT Team
Charles C. Berry wrote: > > You want > > ?regexpr > > Something like > > regexpr("Jalapa", as.character( unidad ) ) != -1 > > HTH, > > Chuck Please, look at this... > substringJalapa <- regexpr("Jalapa", as.character(conagua$unidad ) ) != -1 Hubo 50 o más avisos (use warnings() para v

Re: [R] looking for a string

2008-04-14 Thread [Ricardo Rodriguez] Your XEN ICT Team
Thanks! Here what I get: Henrique Dallazuanna wrote: > Try something like this: > > x[grep("Jalapa", x$unidad),, drop = F] > > conaguaMexicoSub <- subset(conagua, unidad == x[grep("Jalapa", x$unidad),, drop = F], select = c(equipo,X101:X309)) Error en x$unidad : $ operator is invalid for atomi

Re: [R] looking for a string

2008-04-14 Thread Henrique Dallazuanna
Try something like this: x[grep("Jalapa", x$unidad),, drop = F] On Mon, Apr 14, 2008 at 9:10 PM, [Ricardo Rodriguez] Your XEN ICT Team < [EMAIL PROTECTED]> wrote: > Hi all, > > I have not been able to find an answer to what is a simple question: > > conaguaMexicoSub <- subset(conagua, unidad ==

Re: [R] looking for a string

2008-04-14 Thread Charles C. Berry
On Tue, 15 Apr 2008, [Ricardo Rodriguez] Your XEN ICT Team wrote: Hi all, I have not been able to find an answer to what is a simple question: conaguaMexicoSub <- subset(conagua, unidad == "Jalapa", select = c(equipo,X101:X309)) This subset gives me all the rows from conagua where unidad is J

[R] looking for a string

2008-04-14 Thread [Ricardo Rodriguez] Your XEN ICT Team
Hi all, I have not been able to find an answer to what is a simple question: conaguaMexicoSub <- subset(conagua, unidad == "Jalapa", select = c(equipo,X101:X309)) This subset gives me all the rows from conagua where unidad is Jalapa. But, please, how do I get all the rows where unidad contents