I have a small R dataframe below containing cars made in Japan and in Mexico from 2006 to 2008. I need to calculate the ratio between the average engine life for the cars built in Japan and Mexico for each year. I am using dplyr and so far I have been able to group by year and place built.
However I am stuck in this part. Any idea how I can calculate the ratio between the average engine life for cars built in Japan and Mexico for each year?
Here is the code I used:
cars_df %>%
group_by(year_built, place_built) %>%
summarise(car,year_built,place_built,
avg_life_exp = mean(engine_life_expectancy))
