[R] ANother s-plus to R problem

Ognen Duzlevski maketo at sdf.lonestar.org
Fri Dec 5 18:07:33 CET 2003


Hi all, thank you for replying so quickly!

I have another problem:

 step.wise <- stepwise(data.table[,names(good.motifs[,1])], data.table[1],
f.crit=fval.cutoff)

s-plus has the stepwise() formula but R has step() and stepAIC() from base
and MASS packages. I cannot seem to figure out how to convert the above
stepwise to either step() or stepAIC().

> data.table[,names(good.motifs[,1])]
SO0404 -9.861773e-02 -3.280285e-02 -1.005750e-01 -7.363912e-02
-5.880977e-02
SO0403  3.962532e-02  9.791646e-03  2.854144e-03  3.393920e-02
5.433459e-02
SO0314  4.286539e-02  4.075057e-02  1.594184e-02  2.591711e-02
-6.343293e-04
SO4348  4.027333e-02  3.888057e-02  2.521229e-02 -4.118126e-04
-3.077392e-03
SO3919  1.219271e-02 -2.675035e-03  5.320541e-02 -4.118126e-04
2.410169e-02

> data.table[1]
SO0404 -0.11244436
SO0403 -0.11963379
SO0314 -0.13039490
SO4348 -0.14484288
SO3919 -0.14548809

Can anyone help?

Best regards,
Ognen

On Fri, 5 Dec 2003, Tony Plate wrote:

> Date: Fri, 05 Dec 2003 09:57:56 -0700
> From: Tony Plate <tplate at acm.org>
> To: Ognen Duzlevski <maketo at sdf.lonestar.org>, r-help at stat.math.ethz.ch
> Subject: Re: [R] s-plus to R
>
> I'd suggest just removing the "+" and see if that works.  It's somewhat
> difficult to say whether that would be safe without seeing more of your
> code, but "+" as a unary operator on character vectors seems to be an
> identity function in S-plus 6.1, e.g.:
>
>  > print(+ letters[1:3])
> [1] "a" "b" "c"
>  > deparse(+ letters[1:3])
> [1] "c(\"a\", \"b\", \"c\")"
>  >
>
> Maybe it has some side effects in S-plus (like invisible()?), but if the
> code depends on these you will probably have to code these in a different
> way in R anyway.  I don't know -- I haven't before seen "+" used as a unary
> operator on character vectors.
>
> hope this helps,
>
> Tony Plate
>
>
> At Friday 04:33 PM 12/5/2003 +0000, Ognen Duzlevski wrote:
> >Hi, I have a piece of code originally written for s-plus - I am trying to
> >run it in R now. The code was obtained from someone who is now not
> >available to give any pointers and I am a beginner in R. Here is where it
> >is getting stuck:
> >
> > > +names(good.motifs[,1])
> >Error in +names(good.motifs[, 1]) : Invalid argument to unary operator
> >
> >here is now names(good.motifs,1]) looks:
> > > names(good.motifs[,1])
> >[1] "Motif.P1.8.3"  "Motif.P1.9.14" "Motif.P1.10.1" "Motif.P1.11.8"
> >[5] "Motif.P1.15.1"
> >
> >Can anyone help with an equivalent in R?
> >
> >Thanks,
> >Ognen
> >
> >______________________________________________
> >R-help at stat.math.ethz.ch mailing list
> >https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
> Tony Plate   tplate at acm.org
>
>

maketo at sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org




More information about the R-help mailing list