The write. function allows one to export a JSON file, but it does not seem to work for a GeoJSON file.
This is the code i ran:
and this was the error produced:
Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'S4') cannot be handled by 'cat'