I have a dataframe df, and it has a column col of character() type. Columns are filled by Sql Query results. Sometimes sql query returns empty set. If col is empty, I want to set it to NA. How I can achieve that?
Assume this: I'm assigning currently col <- select 1 from Table (returns empty set). If col is empty, I want to set it to NA
col
[1] result
<0 rows> (or 0-length row.names)