if field is a list of 1 with NULL value it still fails in if (nchar(trimws(field)) > 0) { }. This is because trimws and nchar will return empty vectors which lead to argument is of length zero error.
Also need to better handle cases of multiple entries for each field better
if field is a list of 1 with NULL value it still fails in
if (nchar(trimws(field)) > 0) { }
. This is because trimws and nchar will return empty vectors which lead to argument is of length zero error.Also need to better handle cases of multiple entries for each field better