R Programming
code-
employee.data <- read.csv("employee-data.csv", skip = 23, stringsAsFactors = FALSE)
employee.data <- as.tibble(employee.data)
employee.data
employee.data$gender <- as.factor(employee.data$gender)
employee.data$title <- as.factor(employee.data$title)
employee.data error- 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'.
employee.data <- as.tibble(employee.data)
employee.data
employee.data$gender <- as.factor(employee.data$gender)
employee.data$title <- as.factor(employee.data$title)
employee.data error- 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'.
1 answers ( 0 marked as helpful)
Hi Viraj,
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.
Best,
Eli