I have the following dataframe.
age pclass title
32 2 Married Man
3 Married Man
40 1 Married Women
47 3 Married Women
2 Married Women
5 3 Married Man
As you can see "AGE" column can have Missing Values, and while "pclass" column is a integer one, "title" column is a non integer column.
What I have to do is to replace Non Values from Age column with the median of the two other columns (title and pclass).
Replace non values from Age column by the median of pclass and title
I don't know if it's possible to calculate the median of two values.
Here is my code, it works but I don't know if it's correct.
median(as.numeric(titanic$title),titanic$pclass, na.rm = T)
Thanks.