Try this:

x[2:3] <- t(apply(x[-1], 1, sort))

On Thu, Feb 3, 2011 at 1:57 PM, sudhir cr <sudhir...@gmail.com> wrote:

> Hi,
>
>
>
> I have data like this....
>
>
>
> print(x)
>
>
>
> ID      VAL1    VAL2
>
> 1       B       A
>
> 2       P       Q
>
> 3       T      S
>
>
>
> What I would like is data like this...
>
>
>
> ID      VAL1    VAL2
>
> 1       A       B
>
> 2       P       Q
>
> 3       S      T
>
>
>
>
>
> So that VAL1 and VAL2 are alphabetically ordered.
>
>
>
> Any advice is welcome!
>
>
>
> San.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to