I am very new to R and coding in general.
I would like to create a new variable in the mtcars dataframe called "x". If the transmission is automatic, then taken the sum of mpg and disp. If the transmission is manual, then take the sum of mpg and cyl.
How would I do this? Thank you!
mtcars$x <- mtcars$mpg + ifelse(mtcars$a == 0, disp, cyl)- r2evanstransform(mtcars, x = mpg + ifelse(am==0, disp, cyl))- r2evans