Re: [R] matrix form

2005-07-29 Thread Adaikalavan Ramasamy
If you mean how to create a matrix like below, then you can code it as

   arm   - 1:10
   study - rep( 1:4, c(3,3,2,2) )
   Num   - c(2, 9, ...)

   df - cbind( arm, study, Num )

but this is really painful. If you have this information stored in
Excel, save it as tab delimited or comma separated format and read in
using read.delim or read.csv respectively. You can also use scan.
See help(read.delim), help(read.csv) or help(scan).
   
If you mean how to extract information from such a matrix, then see
help(subset) or read the manuals.

Regards, Adai



On Thu, 2005-07-28 at 17:45 +0100, Hathaikan Chootrakool wrote:
 I am a new user, i was wondering how to define a collection of data in
 matrix form,
 this is a part of my data,there are 26 studies, 3 Treatments
 
Arm No  Study no.  Treatment  Num(r) Total(n)
 111 1  243
 221 2  942
 331 3  13   41
 442 1  12   68
 552 2  13   73
 662 3  13   72
 773 1   4   20
 883 3   4   16
 994 1  20   116
 10  104 3  30   111
 
 I would like to use matrix [study No,Treatment] how can i define code for
 using matrix?
 
 has anyone can help me?,thank you very much.
 
 Hathaikan
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] matrix form

2005-07-28 Thread Hathaikan Chootrakool

I am a new user, i was wondering how to define a collection of data in
matrix form,
this is a part of my data,there are 26 studies, 3 Treatments

   Arm No  Study no.  Treatment  Num(r) Total(n)
111 1  243
221 2  942
331 3  13   41
442 1  12   68
552 2  13   73
662 3  13   72
773 1   4   20
883 3   4   16
994 1  20   116
10  104 3  30   111

I would like to use matrix [study No,Treatment] how can i define code for
using matrix?

has anyone can help me?,thank you very much.

Hathaikan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html