我在R中下载了celestial软件包,将数据从几分钟转换为度数格式,但出现错误。数据以经度和纬度为单位,格式为80'13'007。
targetCounts$LongitudeDD <- dms2deg(targetCounts$Longitude, sep = "'")
targetCounts$LatitudeDD <- dms2deg(targetCounts$Latitude, sep = "'")
Error in if (any(d < -90 | d > 90) & sign[1] == "d") { :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In Ops.factor(d, -90) : ‘<’ not meaningful for factors
2: In Ops.factor(d, 90) : ‘>’ not meaningful for factors
targetCounts$LongitudeDD <- dms2deg(targetCounts$Longitude, sign = "d", sep = "'")
Error in if (any(d < -90 | d > 90) & sign[1] == "d") { :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In Ops.factor(d, -90) : ‘<’ not meaningful for factors
2: In Ops.factor(d, 90) : ‘>’ not meaningful for factors
我的数据中没有空格,所以现在我知道这不是问题。
> is.na(targetCounts$Longitude)
[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE
[16] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE
[31] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE
[46] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE
[61] FALSE FALSE FALSE FALSE FALSE
> str(targetCounts)
'data.frame': 65 obs. of 5 variables:
$ Trip : int 1638 1638 1638 1638 1638 1638 1639 1639 1639 1639 ...
$ Lance : int 1 2 3 4 5 6 1 2 3 4 ...
$ Fecha : Factor w/ 54 levels "01/04/2017","02/03/2017",..: 36 38 40 43
46 48 2 4 7 10 ...
$ Latitude : Factor w/ 65 levels "06'19'365","06'21'050",..: 39 12 10 13 2
6 4 3 5 21 ...
$ Longitude: Factor w/ 65 levels "79'44'179","79'46'107",..: 16 52 58 65 64
60 56 57 55 36 ...
感谢任何帮助。