i want to substract and square the difference of two columns in dataframe by creating a new variable.
IMDB1 imdbVotes imdbRating 45 2700 56 750 N/A 800 67 1400 N/A 850
when i use this code
sub=IMDB$IMDBvote-IMDB$IMDBrating
i get
In Ops.factor(IMDB1$imdbRating, IMDB1$imdbVotes) : ‘-’ not meaningful for factors
.then later i used
votes=as.numeric(IMDB1$imdbVotes)
rating=as.numeric(IMDB1$imdbRating)
and checked still im getting
‘-’ not meaningful for factors.
please help me to get the square of difference of imdbrating
and imdbvoting
by creating new varibale