I have encountered some odd behaviour trying to work with data exported from feature classes using the Export Feature Attributes to ASCII tool in ArcDesktop 10.4.1 (advanced licence). The data looks like this with up to ~3000 rows:
I'm doing some further processing in R using the following for loop:
for (row in 1:nrow(input_angles_t$`030918`)){
S_tmpX <- input_angles_t$`030918`[row, "START_X"]
S_tmpY <- input_angles_t$`030918`[row, "START_Y"]
FID <- input_angles_t$`030918`[row, "FID"]
for (row in 1:nrow(input_angles_t$`030918`)){
if (input_angles_t$`030918`[row, "FID"] != FID & input_angles_t$`030918`[row, "START_X"] == S_tmpX & input_angles_t$`030918`[row, "START_Y"] == S_tmpY & input_angles_t$`030918`[row, "BEARING"] == 0){
input_angles_t$`030918`[row, "BEARING"] <- 359
}
}
}
the input_angles_t$030918`` input is a data frame like that shown above. When I run this loop on data exported from a shapefile, it works fine. However, when I run the same loop on the same data but exported from a feature class in geodatabase, R throws the following error:
Error in if (input_angles_t$`030918`[row, "FID"] != FID & input_angles_t$`030918`[row, : argument is of length zero
I've looked into what this error means and it is to do with NULL or 0 length vector arguments that stop the if statement from evaluating. I've checked for NULLs in the data and there aren't any. What is weirder is that it runs the line S_tmpX <- input_angles_t$030918[row, "START_X"] and I get S_tmpX as an output before it throws an error saying that essentially the same line of code produces a zero length argument. And as stated above, this ONLY happens on .csv exports from feature classes, not on exactly the same data from a shapefile.
Has anyone else ever come across similar problems and found a solution? At the moment my solution will be to just work with shapefiles for this task, but I prefer file management with geodatabases, so if I could go back to using feature classes in GDBs, that would be preferable.

input_angles_t$030918a data.frame? Are you sure? Check if is a column ofinput_angles_t– aldo_tapia Mar 14 '18 at 11:52