daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest May 16th, 2018 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. B[1-10] <- A[2-6, and 11-16]
  2.    
  3. # example 1 column matrix
  4. A <- matrix(1:20, ncol = 1)
  5.    
  6. B <- A[ c(2:6, 11:16), 1 ]
  7. dim(B)
  8. # NULL
  9. class(B)
  10. # [1] "integer"
  11.    
  12. B <- A[ c(2:6, 11:16), 1, drop = FALSE ]
  13. dim(B)
  14. # [1] 11  1
  15. class(B)
  16. # [1] "matrix"
  17.    
  18. B = as.matrix (c(A[2:6,1],A[11:16,1]))
RAW Paste Data
Top