[S] data manipulation

Dr. L. Y. Hin (z044106@mailserv.cuhk.edu.hk)
Fri, 16 Oct 1998 02:49:28 +0800


Dear S-plusers,

I am in the process of translating all my algortihms that had previously
been written in APL into S, and I have several difficulties. Would be very
grateful if you can help:

Let's say there exists a, whereby a<-c(1,2,3,4,5,6,7,8,7).

(1) How do we drop the third element only, leaving a to be 1 2 4 5 6 7 8 7 ?

(2) How do we repalce the second element with vector c(10,11,12), yielding
the vector 1 10 11 12 3 4 5 6 7 8 7?

(3) How do we reverse the sequence of a, yielding 7 8 7 6 5 4 3 2 1?

(4) How do we rotate the vector forward by three place, yielding the vector
7 8 7 1 2 3 4 5 6?

(5) How do we rotate the vector backwards two places, yielding the vector
3 4 5 6 7 8 7 1 2?

Much obliged.

Lin

--------------------------------------------------------------------
Dr. L. Y. Hin
Department of Obstetrics & Gynaecology
Prince of Wales Hospital
Hong Kong SAR
Tel. (852) 2632 2807
Fax. (852) 2636 0008
--------------------------------------------------------------------

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news