[R] Help translating S-Plus command
Bernat Claramunt Lopez
bernat at creaf.uab.es
Tue Nov 6 13:48:43 CET 2007
Thank you very much.
Worked perfectly !!
El dl 05 de 11 del 2007 a les 22:17 +0000, en/na Prof Brian Ripley va
escriure:
> It would help if we knew what that command was supposed to do. My guess
> is that you want the Tr$size with the smallest value of Tr$dev, in which
> case
>
> Tr$size[which.min(Tr$dev)]
>
> would seem to do it. However, there are details like what is to happen if
> there are ties for the smallest value.
>
> (There are simpler ways in S-PLUS to sort one variable by the values of
> another, for example Tr$size[sort.list(Tr$dev)] which works the same way
> as in R.)
>
> On Mon, 5 Nov 2007, bernat at creaf.uab.es wrote:
>
> > Dear all
> > I have a small routine in S-Plus that I would like to use in R. There are some small changes I've been able to adapt, but I don't know how to translate the line starting with "g1<-sort.col...." and the one "Size<- c(Size...") (I also add some lines before)
> > (...)
> > Size<-NULL
> > g<-cbind(Tr$dev,Tr$size)
> > (...)
> > g<-data.frame(g)
> >
> > # these next two lines are the ones I need help for
> >
> > g1 <- sort.col(target=g, columns.to.sort="@ALL", columns.to sort.by=list("g.1"), ascending=T)
> > Size<-c(Size,g1[1,2])
> >
> > Thanks in advance
> > Bernat
> >
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > 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.
> >
>
More information about the R-help
mailing list