I am working with a list of df's, I would like to change this typo "-" for NA for every df row for every df column for every df in the list.
However when I run the next code and then unlist to verify if it worked, the output remains the same "-" insted of NA:
for(i in 1:length(df_list)){
for(j in i){
for(z in j){
if(df_list[[i]][[j]][[z]] == "-"){
return(NA)
} else {
df_list[[i]][[j]][[z]]
}
}
}
}
## unlist to verify ##
for(i in names(df_list)){
assign(i, df_list[[i]], .GlobalEnv)
}
##verifying ##
df1[1, "col"]
// output //
"-"
Is there anyway to do this in R with other object?