简体   繁体   English

提取R中的向量或矩阵的条目

[英]extract entry of a vector or Matrix in R

i have this matrix 我有这个矩阵

> dist
     1    2    3    4    5    6    7
1 0.00 0.52 0.34 0.37 0.37 0.52 0.54
2 0.52 0.00 0.77 0.57 0.57 0.00 0.56
3 0.34 0.77 0.00 0.29 0.29 0.77 0.53
4 0.37 0.57 0.29 0.00 0.00 0.57 0.32
5 0.37 0.57 0.29 0.00 0.00 0.57 0.32
6 0.52 0.00 0.77 0.57 0.57 0.00 0.56
7 0.54 0.56 0.53 0.32 0.32 0.56 0.00

I WANT TO extract the row number 1 but since the third position 0.34 0.37 0.37 0.52 0.54 我想提取行号1,但由于第三个位置是0.34 0.37 0.37 0.52 0.54

i try with dis[1,>=3] but there is a error 我尝试使用dis[1,>=3]但是有错误

您可以使用[

dist[1,3:7]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM