Change specific column values in R -


I have a table where "NA" is present in all the places, especially in one column, each example of "NA" Want to change with something else - say, number 1

How should I do this?

Jonathan found the correct answer for the vector, using which you applied the column to the data frame data You can:

  & gt; Dat & lt; -data.frame (a = c (11,2, 11, n), b = c (1,1,1,1)) gt; Dat $ a [is.na (dat $ a)] & lt; - 1  

Deducer produces the following code for the completion of the 'Record Variable' dialogue, which can do more complex recodings.

  & gt; Library (DDUs) & gt; Dat [c ("a"]] & lt; - recode.variables (dat [c ("a")], "NA -> 1;")  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -