r-spatial / link2GI

Simplify the linking of GIS/RS and CLI tools
https://r-spatial.github.io/link2GI
GNU General Public License v3.0
25 stars 7 forks source link

Error when args[[j]] is NA #19

Closed goergen95 closed 5 years ago

goergen95 commented 5 years ago

I ran into some issues while trying to set up OTB, giving this error:

algo_cmd <- parseOTBFunction(algos = algos[90], gili = otb)
Error in if (sapply(args, "[", 4)[[j]] == "Report progress ") default <- "false" else default <  : 
  missing value where TRUE/FALSE needed.

I narrowed the issue down to the code block where the program checks for lines to drop. With some tools (e.g. segmentation.bat) it will cause an NA value which currently makes the program stop.

sapply(args, "[", 4)[[j]])

Could be a good idea to compensate this with dropping a line if the returned value is NA? I also realized it is on your to-do-list to adapt the program to changes in the OTB software so you might already be aware of the issue.

Cheers!

https://github.com/r-spatial/link2GI/blob/c6c904c9a36e185d9221f00831b35e3428960c10/R/parseOTB.R#L164

gisma commented 5 years ago

I Think you exceed the number of functions in the returned list. Pls check length(algos)

gisma commented 5 years ago

@goergen95 I tried to fix this error by a workaround. I hope it work so far.