Load the stats package for gamma distribution functions

library(stats)

Parameters of the gamma distribution

k <- 10 # shape parameter theta <- 2 # scale parameter

Calculate the probability P(X > 22) using the gamma distribution CDF

prob_x_gt_22 <- 1 - pgamma(22, shape = k, scale = theta)