Hi Prasanth,
Using the function fieldIndex() with the original image, you must calculate different indices ("BI", "BGI", "SCI", etc) and chose one to identify the soil.
Then, using fieldMask() you can use this index, the value to crop (cropValue), and the direction to crop (cropAbove = TRUE or FALSE).
Please, let me know if you got this.
Best
Filipe