Join files to calculate percentage mortality

You have not provided any sample data to work with, so I invented some. I used functions from the dplyr package to join the data and make a new column. If you need more specific help, please provide samples of your data in a reproducible example as explained in the link below.

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

#invent data
Admit <- data.frame(cancer_type = c("A", "B", "C"), Admissions = c(123, 264, 97))
Deaths <- data.frame(cancer_type = c("B", "C", "A"), Died = c(57, 23, 60))

#Join the data
AllDat <- inner_join(Admit, Deaths, by = "cancer_type")
AllDat
#>   cancer_type Admissions Died
#> 1           A        123   60
#> 2           B        264   57
#> 3           C         97   23

#Calculate the rate
AllDat <- AllDat %>% mutate(Rate = Died/Admissions)
AllDat
#>   cancer_type Admissions Died      Rate
#> 1           A        123   60 0.4878049
#> 2           B        264   57 0.2159091
#> 3           C         97   23 0.2371134

Created on 2021-06-21 by the reprex package (v0.3.0)

FAQ: How to do a minimal reproducible example ( reprex ) for beginners - meta / Guides & FAQs - RStudio Community