I seem to have stumbled upon a predicament in my efforts to learn using R. I have a dataset that looks like this:
col1 / col2 / col3 NA / 1 / 2 1 / NA /2
What I need to do is replace everything that IS NOT NA with another value (see below)
Col1 / col2 / col 3 NA / Data / Data Data / NA/ Data
I've looked everywhere on the web, it seems that everybody wants to replace NA
's with other values, I on the other hand need the exact opposite but was unable to find any command. I even looked into "IF's" but was only able to find functions that replace values if they are eiter <
or =
or >
to a certain number. I need something that will specify..."IF different from NA
, then replace with...."