On May 15, 2013, at 11:24 PM, Pascal Oettli wrote:
> Hi,
>
> You probably should read R documentation and learn how to use "seq"
>
> ?seq
> ?rowMeans
>
> HTH,
> Pascal
>
>
> On 05/16/2013 03:17 PM, Zilefac Elvis wrote:
>> Hello,
>>
>> I need your help on this matrix:
>>
>>
>> 1 1 1 1 1 1
May be this helps:
mat1<- as.matrix(read.table(text="
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
5 5 5 5 5 5
2 2 2 2 2 2
3 3 3 3 3 3
6 6 6 6 6 6
2 2 2 2 2 2
3 3 3 3 3 3
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
",sep="",header=FALSE))
colnames(mat1)<- NULL
t(sapply(1:3,function(i) colMeans(mat1
Hello,
Try the following.
mat <- matrix(scan(text = "
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
5 5 5 5 5 5
2 2 2 2 2 2
3 3 3 3 3 3
6 6 6 6 6 6
2 2 2 2 2 2
3 3 3 3 3 3
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
"), ncol = 6, byrow = TRUE)
idx <- 1 + (seq_len(nrow(mat)) - 1) %% 3
aggregate(mat, l
Hi,
You probably should read R documentation and learn how to use "seq"
?seq
?rowMeans
HTH,
Pascal
On 05/16/2013 03:17 PM, Zilefac Elvis wrote:
Hello,
I need your help on this matrix:
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
5 5 5 5 5 5
2 2 2 2 2 2
3 3 3 3 3 3
6 6 6 6 6 6
2 2 2
4 matches
Mail list logo