employee.data <- read.csv(“employee-data.csv”, skip = 23, stringsAsFactors = FALSE)
employee.data <- as.tibble(employee.data)
employee.data$gender <- as.factor(employee.data$gender)
employee.data$title <- as.factor(employee.data$title)
Error in `$<-.data.frame`(`*tmp*`, gender, value = integer(0)) :
replacement has 0 rows, data has 177
In addition: Warning message:
Unknown or uninitialised column: ‘gender’.
thanks for reaching out! I was able to run your code and I’m not getting error message. What I’d suggest is to double check if you’ve loaded the employee-data csv file properly. The error message suggests that some columns in your data might be empty, which shouldn’t be the case.