After some headache with debugging my script, I finally isolated the problem 
taht I am going to illustrate in the following example.
I expected matrix nrow to decrease consistently till 1. Instead, when the 
matrix is left with one row only, its nrow jumps to 2 because the matrix 
gets transposed. How come ?
Thank you,
Maura 

> B <- c(1,2)
>  B <- rbind(B,c(3,4))
>  B <- rbind(B,c(5,6))
>  B
  [,1] [,2]
B    1    2
     3    4
     5    6
> dim(B)
[1] 3 2
> nrow(B)
[1] 3
> 
> #REMOVE ROW-1 OUT OF 3 
>  B <- as.matrix(B[-1,])
>  B
 [,1] [,2]
    3    4
    5    6
> dim(B)
[1] 2 2
> nrow(B)
[1] 2
> 
> #REMOVE ROW-2 OUT OF 3
>  B <- as.matrix(B[-1,])
>  B
     [,1]
[1,]    5
[2,]    6
> dim(B)
[1] 2 1
> nrow(B)
[1] 2



tutti i telefonini TIM!


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to