[R] Regexp question
johannes rara
johannesraja at gmail.com
Wed May 4 22:41:34 CEST 2011
Thank you all!
2011/5/4 David Wolfskill <r at catwhisker.org>:
> On Wed, May 04, 2011 at 10:41:36PM +0300, johannes rara wrote:
>> I have a string like this
>>
>> st <- "SELECT COUNT(empid), COUNT(mgrid), COUNT(empname),
>> COUNT(salary), FROM Employees"
>>
>> How can I remove the last comma before the FROM statement?
>
> This doesn't use a regex, per se, but:
>
>> st <- "SELECT COUNT(empid), COUNT(mgrid), COUNT(empname), COUNT(salary), FROM Employees"
>> st
> [1] "SELECT COUNT(empid), COUNT(mgrid), COUNT(empname), COUNT(salary), FROM Employees"
>> sub(", FROM", " FROM", st)
> [1] "SELECT COUNT(empid), COUNT(mgrid), COUNT(empname), COUNT(salary) FROM Employees"
>>
>
> I'm not sure that's what you had in mind, though.
>
> Peace,
> david
> --
> David H. Wolfskill r at catwhisker.org
> Depriving a girl or boy of an opportunity for education is evil.
>
> See http://www.catwhisker.org/~david/publickey.gpg for my public key.
>
More information about the R-help
mailing list