HI,
You could try:
mat1 <- matrix(0,8,8)
diag(mat1) <- 5
mat2 <- apply(mat1,2,rev)
diag(mat2) <- 5
indx<- which(mat2==5)
mat2[indx[indx%%8==1]+1] <-1
mat2[indx[indx%%8==0]-1] <-1
mat2[indx[!(indx%%8==0 | indx%%8==1)]-1][mat2[indx[!(indx%%8==0
|indx%%8==1)]-1]==0] <- 1
mat2[indx[!(indx%%8
tion, TX 77840-4352
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Srdjan Santic
Sent: Tuesday, December 3, 2013 5:44 AM
To: r-help@r-project.org
Subject: [R] Generating a matrix
I'm trying to write a function that will generate a NxN ma
I'm trying to write a function that will generate a NxN matrix that has
the value K on both diagonals, while the values outside the diagonals
(up and down) are 1's (for conflicting positions such as [4,5] and [5,4]
the larger value is written in the matrix). Basically, I'm trying to
replicate t
rmountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of John Seppänen
> Sent: Friday, November 27, 2009 4:30 AM
> To: r-help@r-project.org
> Subject: [R] generatin
Hi all,
I have to ask this and I know that the reason is that I am a newbie with R
programming. So apologize if it is too obvious but I didn't find an answer
after googling and reading "An introduction to R". So i have return
data from 30 instruments and I am fitting a mixture of normal
distributi
5 matches
Mail list logo