[R] matrix form
Adaikalavan Ramasamy
ramasamy at cancer.org.uk
Fri Jul 29 12:11:59 CEST 2005
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)
> 1 1 1 1 2 43
> 2 2 1 2 9 42
> 3 3 1 3 13 41
> 4 4 2 1 12 68
> 5 5 2 2 13 73
> 6 6 2 3 13 72
> 7 7 3 1 4 20
> 8 8 3 3 4 16
> 9 9 4 1 20 116
> 10 10 4 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 at 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
>
More information about the R-help
mailing list