Try split()!
?split
e.g
> a
var1 var2 var3
1 a14
2 a25
3 a36
4 b47
5 b58
6 a69
7 b7 NA
8 c82
9 c95
10b34
11a24
12a14
13c23
14c54
6
, , 2
[,1] [,2] [,3]
[1,]789
[2,] 10 11 12
Good day!
Kushantha Perera | Amba Research
Ph +94 11 235 6281 | Mob +94 77 222 4373
Bangalore * Colombo * London * New York * San José * Singapore *
www.ambaresearch.com
-Original Message-
From: r-help-boun...@r-pro
Try, data[data$id%in%selected.id,]
Good day!
Kushantha
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of abdul kudus
Sent: Wednesday, May 06, 2009 10:12 AM
To: r-help@r-project.org
Subject: [R] subset data
Dear all,
> data <- data.
row() gives the row number of each element of the matrix, similarly
col() gives the column number. By definition, diagonal elements are the
elements correspond to same row and column numbers. That's how it
works...
x <- matrix(1:12, 3, 4)
> x
[,1] [,2] [,3] [,4]
[1,] 12963
[2,]
4 matches
Mail list logo