Error: non-numeric argument to binary operator

r

#1

I have written simple R code but while running my code it giving me error .I want to know how I can remove this error.

# Assign a value to the variable called 'my_apples'
my_apples <- 5 

# Print out the value of 'my_apples'
my_apples       

# Assign a value to the variable 'my_oranges' and print it out
my_oranges <- "six" 
my_oranges 

# New variable that contains the total amount of fruit
my_fruit <- my_apples + my_oranges 
my_fruit

#2

@sid100158 - I think you are trying to add two variables which are of a differnt class that’s why it giving you an error.

Change the variable my_oranges to numeric or change the variable my_apples to character , then it will not give you any error.

Hope this helps!

Regards,
Hinduja