Hi,
I was irritated about your printed last row of A, which apart from
definition contains a 20. Anyway, how about this:
y<-x<-rep(NA,nrow(A))
#its not clear, whether multiple values of 100 can occur in a single
#row, and what to do, when 100 is found before and after 20, so you may
#alter the in
I have a following matrix and wish to define a variable based the variable
A=matrix(0,5,5)
A[1,]=c(30,20,100,120,90)
A[2,]=c(40,30,20,50,100)
A[3,]=c(50,50,40,30,30)
A[4,]=c(30,20,40,50,50)
A[5,]=c(30,50,NA,NA,100)
> A
[,1] [,2] [,3] [,4] [,5]
[1,] 30 20 100 120 90
[2,] 40 30 2
2 matches
Mail list logo