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 programmig

R programmig

0
Votes
1
Answer

code-
library(tidyverse)
install.packages(“ggthemes”)
library(ggthemes)
emp <- read.csv(“employee-data.csv”,skip = 23, stringsAsFactors = T)
emp <- as.tibble(emp)
emp
emp$gender <- as.factor(emp$gender)
emp$title <- as.factor(emp$title)
error-
> emp$gender <- as.factor(emp$gender)
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, 
you need to make sure you load the employee data set correctly. Your error shows a column might be empty, which shouldn’t be the case.
 
Best, 
Eli