I have a Dataframe in R where certain rows in some of the columns have values that are NA
or empty strings ""
. I want to convert these to NULL
values.
So I need any cells in my data frame that are NA
or ""
to be NULL
. How can I do this?
When I try:
DF[ , DF$Column == NA] <- NULL
or
DF[ , DF$Column == ""] <- NULL
I get the error: missing values are not allowed in subscripted assignments of data frames
If I try:
DF[ , is.na(DF$Column)] <- NULL
I get the error: duplicate subscripts for columns
If I try:
is.na(DF$Column) <- NULL
or
DF[DF == NA] <- NULL
I dont get any errors, but nothing changes in my dataframe.