I am looking at a video game dataset
I'm trying to calculate the average User score (User_score column in the dataset).
The issue I'm facing is that when ever I try to use the mean function to get the User score average , I always get this error:
"‘>’ not meaningful for factors[1] 16" and i get Nan as a result .
I looked up this problem online and it seems that it happens because I'm trying to find the mean for a categorical variable, however when I use typeof()
to check the data type for User_score it says its a integer which is the same as another column I found the mean of(Critic_Score). i tried to remove all rows that have NAN and NA's in order for it to work but it hasn't.
Here is what I tried so far
game_data = read.csv('Video_Games_Sales_as_at_22_Dec_2016.csv')
game_data <- mutate(game_data, Critic_Score = ifelse(Critic_Score > 100, NA, Critic_Score))
game_data <- game_data[complete.cases(game_data), ]
typeof(game_data$User_Score)
typeof(game_data$Critic_Score)
#game_data$User_Score = as.numeric(game_data$User_Score)
game_data <- mutate(game_data, User_Score = ifelse(User_Score > 10, NA, User_Score))
head(game_data)
ncol(game_data)
nrow(game_data)
mean(game_data$Critic_Score, na.rm = T)
mean(game_data$User_Score,na.rm = T)
here are the results
[1] "integer"
[1] "integer"
‘>’ not meaningful for factors[1] 16
[1] 7017
[1] 70.24982
[1] NaN
I was wondering if anyone could help