I have data with 5 columns in a variable called studentData
. Each column has 326 rows, except one which has 3 rows missing. Each column is a 5 point likert value, from the set mylevels <- c('Strongly disagree', 'Disagree', 'Neither agree nor disagree', 'Agree', 'Strongly agree')
When I print the number of levels in each column it gives me value as 6 for the second column (studentData$Increased.confidence), because it has 3 missing values which R interprets as another factor for this column.
> sapply(studentData, function(x) { length(levels(x)) } ) # The number of levels in each factor
ï..Increased.engagement Increased.confidence Improved.writing.skills
5 6 5
Made.useful.contribution.to.course Should.keep.games.for.future.students
5 5
Because of this I get the error stating that the number of levels should be same for likert function to work. How should I handle those 3 missing values?
> studentLikert <- likert(studentData)
Error in likert(studentData) :
All items (columns) must have the same number of levels