我正在使用數據幀來使用as.ppp
函數創建標記點進程。我收到錯誤Error: is.numeric(x) is not TRUE
。我使用的數據如下:在數據幀上使用as.ppp創建標記進程
dput(head(pointDataUTM[,1:2]))
structure(list(POINT_X = c(439845.0069, 450018.3603, 451873.2925,
446836.5498, 445040.8974, 442060.0477), POINT_Y = c(4624464.56,
4629024.646, 4624579.758, 4636291.222, 4614853.993, 4651264.579
)), .Names = c("POINT_X", "POINT_Y"), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
我可以看到,前兩列是數字的,所以我不知道爲什麼這是一個問題。
> str(pointDataUTM)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 5028 obs. of 31 variables:
$ POINT_X : num 439845 450018 451873 446837 445041 ...
$ POINT_Y : num 4624465 4629025 4624580 4636291 4614854 ...
然後我也查不適用,這表明沒有NA
> sum(is.na(pointDataUTM$POINT_X))
[1] 0
> sum(is.na(pointDataUTM$POINT_Y))
[1] 0
當我試圖甚至只有前兩個的data.frame的專欄中,我獲得使用as.ppp是錯誤這個:
Error: is.numeric(x) is not TRUE
5.stop(sprintf(ngettext(length(r), "%s is not TRUE", "%s are not all TRUE"), ch), call. = FALSE, domain = NA)
4.stopifnot(is.numeric(x))
3.ppp(X[, 1], X[, 2], window = win, marks = marx, check = check)
2.as.ppp.data.frame(pointDataUTM[, 1:2], W = studyWindow)
1.as.ppp(pointDataUTM[, 1:2], W = studyWindow)
有人能告訴我什麼是這裏的錯誤,爲什麼我得到的不是數字錯誤?
謝謝。
是的,這可能是這種情況,因爲我使用dplyr從csv創建數據幀。 – BKS