Thank you all!
2011/5/4 David Wolfskill :
> 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?
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 <-
On Wed, 2011-05-04 at 22:41 +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?
gsub(",[^,]*FROM ", " FROM ", st)
HTH,
Jerome
__
Try this:
gsub(",\\s+FROM", " FROM", st)
On Wed, May 4, 2011 at 4:41 PM, 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?
>
> -J
>
> _
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?
-J
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo
On Wed, Nov 17, 2010 at 2:59 PM, johannes rara wrote:
> I have a vector like this:
>
> a <- c("thisIsName", "thisIsAlsoName", "andThisName")
>
> How to break this into pieces and produce a vector with unique parts:
>
> this
> Is
> Name
> Also
> and
> This
Try this:
library(gsubfn)
strapply(a, ".
Great, thanks!
2010/11/17 Henrique Dallazuanna :
> Try this:
>
> Reduce(union, strsplit(gsub("([A-Z])", ";\\1", a), ";"))
>
> On Wed, Nov 17, 2010 at 5:59 PM, johannes rara
> wrote:
>>
>> I have a vector like this:
>>
>> a <- c("thisIsName", "thisIsAlsoName", "andThisName")
>>
>> How to break thi
Try this:
Reduce(union, strsplit(gsub("([A-Z])", ";\\1", a), ";"))
On Wed, Nov 17, 2010 at 5:59 PM, johannes rara wrote:
> I have a vector like this:
>
> a <- c("thisIsName", "thisIsAlsoName", "andThisName")
>
> How to break this into pieces and produce a vector with unique parts:
>
> this
> Is
I have a vector like this:
a <- c("thisIsName", "thisIsAlsoName", "andThisName")
How to break this into pieces and produce a vector with unique parts:
this
Is
Name
Also
and
This
-J
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/lis
Thanks Romain, works like a charm!
Thanks David!
Best, Andrej
On Jun 16, 10:15 pm, Romain Francois
wrote:
> Le 16/06/10 18:54, Andrej a écrit :
>
>
>
> > Thanks David for your fast reply, but now I realized tat "string" is
> > of type:
>
> >> class(string)
> > [1] "jobjRef"
> > attr(,"package")
Le 16/06/10 18:54, Andrej a écrit :
Thanks David for your fast reply, but now I realized tat "string" is
of type:
class(string)
[1] "jobjRef"
attr(,"package")
[1] "rJava"
so I get an error when i try with gsub or sub:
sub("^.+\\t(\\d+)\\n.+$", "\\1", string)
Error in as.character.default
On Jun 16, 2010, at 1:05 PM, Andrej wrote:
Sorry, I apologize. Below is the minimal example.
library(RWeka)
model <- J48(as.factor(Species)~., data = iris)
model
J48 pruned tree
--
Petal.Width <= 0.6: setosa (50.0)
Petal.Width > 0.6
| Petal.Width <= 1.7
| | Petal.Lengt
Sorry, I apologize. Below is the minimal example.
library(RWeka)
model <- J48(as.factor(Species)~., data = iris)
> model
J48 pruned tree
--
Petal.Width <= 0.6: setosa (50.0)
Petal.Width > 0.6
| Petal.Width <= 1.7
| | Petal.Length <= 4.9: versicolor (48.0/1.0)
| | Petal.L
Publicly produce something we can work with. I have no idea how to
create an example that will match such an object.
?dput
?dump
Read Posting Guide.
--
David.
On Jun 16, 2010, at 12:54 PM, Andrej wrote:
Thanks David for your fast reply, but now I realized tat "string" is
of type:
class(st
Thanks David for your fast reply, but now I realized tat "string" is
of type:
> class(string)
[1] "jobjRef"
attr(,"package")
[1] "rJava"
so I get an error when i try with gsub or sub:
> sub("^.+\\t(\\d+)\\n.+$", "\\1", string)
Error in as.character.default(x) :
no method for coercing this S4 c
On Jun 16, 2010, at 12:04 PM, Andrej wrote:
Dear all,
I'm trying to filter out the "number of leaves" (it should be 1 in the
example below) from the following string:
string
[1] "Java-Object{J48 pruned tree\n--\n: 0 (15.0/3.0)\n
\nNumber of Leaves : \t1\n\nSize of the tree
Dear all,
I'm trying to filter out the "number of leaves" (it should be 1 in the
example below) from the following string:
> string
[1] "Java-Object{J48 pruned tree\n--\n: 0 (15.0/3.0)\n
\nNumber of Leaves : \t1\n\nSize of the tree : \t1\n}"
Any idea how to do that as simple as
17 matches
Mail list logo