0

我已将这个问题发布到 GIS 论坛,但之所以在这里提问,是因为这枚硬币有两个方面——我相信 ArcGIS 人会告诉我问 R 人——所以我在这里问 R 人。我正在尝试从 R 脚本生成的输出文件中引入并创建一个形状文件。因此,我使用以下方法编写我的 csv 文件:

write.table(PointData, paste(RootOutputFileName,"SSF_MvtMetrics_",Date,".csv", sep = ""), row.names = F, sep = ",")

PointData 只是一个数据框。

   structure(list(ID = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("3311_1", 
"3313_1", "3313_2", "3344_1", "3344_2", "3344_3", "3348_1", "3349_1", 
"3350_1", "3352_1", "3352_2", "3352_3", "3353_1", "3353_2", "3353_3", 
"3355_1", "3355_2", "3602_1", "7615_1", "7616_1", "7616_2", "7617_1", 
"7617_2", "7617_3", "7618_1", "7618_2", "7618_3", "7619_1", "7619_2"
), class = "factor"), Date_Time = structure(c(1286529600, 1286529600, 
1286529600, 1286529600, 1286529600, 1286529600), class = c("POSIXct", 
"POSIXt"), tzone = "GMT"), moose = structure(c(7L, 7L, 7L, 7L, 
7L, 7L), .Label = c("F01001", "F070014a", "F07002", "F07005", 
"F07006", "F07010", "F07011", "F07020", "F07021", "F10004", "F10008", 
"F10009", "F98015", "M07012a", "M10011"), class = "factor"), 
    trial = c(1L, 1L, 1L, 1L, 1L, 1L), x = c(1476079, 1475943.59345214, 
    1476063.09369225, 1476103.7686023, 1476191.98817498, 1475969.09165391
    ), y = c(6620355, 6620153.61044344, 6620319.54350105, 6620364.30580689, 
    6620189.01655503, 6620438.97062545), label = structure(c(2L, 
    2L, 2L, 2L, 2L, 2L), .Label = c("after", "before", "dog", 
    "End before", "End Before", "end dog", "End dog", "no dog", 
    "resettles", "Start after", "start dog"), class = "factor"), 
    label.1 = structure(c(2L, 2L, 2L, 2L, 2L, 2L), .Label = c("after", 
    "before", "dog", "no dog", "resettles"), class = "factor"), 
    dog = structure(c(2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Ida", 
    "Ludde", "Tanja"), class = "factor"), Reproduction = structure(c(2L, 
    2L, 2L, 2L, 2L, 2L), .Label = c("Calf", "No Calf"), class = "factor"), 
    Position = c("End", "End", "End", "End", "End", "End"), EvalPt = c(1, 
    1, 1, 1, 1, 1), DistX = c(-13, -148.406547861864, -28.9063077468417, 
    11.7686022959398, 99.9881749765198, -122.908346089521), DistY = c(26, 
    -175.389556564022, -9.45649895283019, 35.3058068878195, -139.983444967128, 
    109.970625448519), Dist = c(29.0688837074973, 229.752040252094, 
    30.4138126514911, 37.2155881318568, 172.026160801199, 164.924225024706
    ), Heading = c(5.81953769817878, 3.8438495850988, 4.39621994880961, 
    0.321750554396642, 2.52134316760697, 5.44228863853642), TimeDif = c(0.166666666666667, 
    0.166666666666667, 0.166666666666667, 0.166666666666667, 
    0.166666666666667, 0.166666666666667), Velocity = c(174.413302244984, 
    1378.51224151257, 182.482875908947, 223.293528791141, 1032.15696480719, 
    989.545350148239), Angle = c(2.67794504458899, 0.702256931509007, 
    1.25462729521981, 3.46334320798643, 5.66293582119676, 2.30069598494663
    ), LocType = c("Obs", "rand", "rand", "rand", "rand", "rand"
    ), LocNum = c(1, 1, 1, 1, 1, 1), RandId = 0:5), .Names = c("ID", 
"Date_Time", "moose", "trial", "x", "y", "label", "label.1", 
"dog", "Reproduction", "Position", "EvalPt", "DistX", "DistY", 
"Dist", "Heading", "TimeDif", "Velocity", "Angle", "LocType", 
"LocNum", "RandId"), row.names = c("3", "2", "31", "4", "5", 
"6"), class = "data.frame")

当我将它带入 ArcGIS 并打开表格时,事情会变得混乱,如我在另一篇文章中所述。

我假设write.table命令发生了一些事情以及我是如何设置的,sep = ","但我真的不知道。当我简单地使用write.csv. 我不明白 R 为什么/如何使用或不使用格式化代码编写对象,然后由 ArcGIS 读取。

在 R 中,为这个 csv 文件生成数据 - 我已经设置as.POSIXct(strptime(loc$Date_Time,"%Y-%m-%d %H:%M",tz="GMT"),tz="GMT")

我根本不知道它从哪里获取 moose.x 或 moose.y 的值,或者 ID_X 或 ID_Y,为什么它要更改 date_time 列中的时间,或者为什么 x 列中的某些值即将到来输出为数字,但其他输出为 0。

如果我与其他问题的链接格式不正确,我并没有试图交叉发布,并道歉 - 我只是不想重新输入所有内容,而是询问是否有人以前遇到过这个问题以及是否有什么我可以添加到我的代码将保持结构格式在 R 之外的这些其他程序中工作。

4

0 回答 0