Have a CSV file with wages.
Attempting to convert a qualitative variable into a numerical variable. The variable is "marital", where 1 denotes being married and 0 denotes being unmarried.
wages = read.csv("Desktop/wages.csv")
wages$marital1=as.numeric(wages$marital1=="married")
Keep getting
Error in `$<-.data.frame`(`*tmp*`, marital1, value = numeric(0)) :
replacement has 0 rows, data has 526
You need to check your variable name (column name), the reason for this problem is usually because the variable name in your function is different from the variable name (column name) in the data frame.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With