The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

R Programming

R Programming

0
Votes
1
Answer

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’.

1 Answer

365 Team
0
Votes

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

×
LAST CHANCE
Ready to Learn Data Science?
50% OFF