我有一个区域的高程矩阵。我想生成一个带有高程的data.frame
,其中colname =经度,rowname =纬度。
原始纬度是
> lat
[1] 36.0 36.2 36.4 36.6 36.8 37.0 37.2 37.4 37.6
[10] 37.8 38.0 38.2 38.4 38.6 38.8 39.0 39.2 39.4
[19] 39.6 39.8 40.0 40.2 40.4 40.6 40.8 41.0 41.2
[28] 41.4 41.6 41.8 42.0 42.2 42.4 42.6 42.8 43.0
[37] 43.2 43.4 43.6 43.8
但在rownames(x) <- lat
之后,它变为,
> rownames(x)
[1] "36" "36.2000007629395"
[3] "36.4000015258789" "36.5999984741211"
[5] "36.7999992370605" "37"
[7] "37.2000007629395" "37.4000015258789"
[9] "37.5999984741211" "37.7999992370605"
[11] "38" "38.2000007629395"
[13] "38.4000015258789" "38.5999984741211"
[15] "38.7999992370605" "39"
[17] "39.2000007629395" "39.4000015258789"
[19] "39.5999984741211" "39.7999992370605"
[21] "40" "40.2000007629395"
[23] "40.4000015258789" "40.5999984741211"
[25] "40.7999992370605" "41"
[27] "41.2000007629395" "41.4000015258789"
[29] "41.5999984741211" "41.7999992370605"
[31] "42" "42.2000007629395"
[33] "42.4000015258789" "42.5999984741211"
[35] "42.7999992370605" "43"
[37] "43.2000007629395" "43.4000015258789"
[39] "43.5999984741211" "43.7999992370605"
其中包含太多小数,现在它已成为字符,我无法使用round()
来减少小数。
谢谢。