imputation in R

Data goes like this:

Df <- data.table( id = c(1,2,3,4, 5,6,7,8,9,10) , age = c(23, 34,26,33,43,13,16,19,21,10) , Death = c(1, 0,NA,1,NA,1,1,0,0,0) , Recover = c(0,1,0,0,NA,0,0,1,NA,1), date = (2013-03-04,NA,2013-04-03,2013-04-03,NA,2013-04-07,2013-04-14,NA,NA,2013-04-28
)
)

i want to remove NA s from above table.
class (date) =date
class(recover)=numeric
class(death)=numeric
i'm new to R, please help me to clean the table using imputation..

Not totally sure I follow. Could you explain in more detail what you are trying to achieve?

In the example below, the 2nd column is set to NULL.

df <- data.frame(
  c1 = 1:3,
  c2 = 1:3
)
df$c2 = NULL

df
#>   c1
#> 1  1
#> 2  2
#> 3  3

is.null(df$c2)
#> [1] TRUE

Created on 2021-08-13 by the reprex package (v2.0.0)

Another strategy to consider is to use R's NA, missing value.

can you please check it once again?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.