I am removing NAs from a number of columns of my dataframe. My dataframe name is pretty long but that is required. It looks a bit messy using the command over and over again so I want to make a function that makes it easier to understand what's happening. I did the following:-
ConvNAtoBlank <- function(colname) { dataframe[[colname]][is.na(dataframe[[colname]])] = "" } This did not work. I have also tried to return the dataframe and assign it again later as:-
dataframe <- ConvNAtoBlank("B") # assuming B is a column name This does not seem to work either. Is there anything I'm doing wrong here? I started learning R this Monday so I'm still a newbie and I can't figure this out. Any help would be appreciated.