It's difficult to figure out what's happening here because we can't run your code (it depends on files in your local file system). When asking questions about code problems, it's good to try to create a reproducible example, if at all possible. See: FAQ: Tips for writing R-related questions.
That said, the error is coming from order()
, which of course doesn't itself have anything to do with the image classification part . The order()
code looks OK on its face, so that suggests that pred_df
has perhaps not actually been created with the structure you're expecting. Can you please paste in the output of running str(pred_df)
?