I am new to programming and started with R since I need it in my Master's courses can someone help me understand the solution step by step.
awards <- c("Won 1 Oscar.",
"Won 1 Oscar. Another 9 wins & 24 nominations.",
"1 win and 2 nominations.",
"2 wins & 3 nominations.",
"Nominated for 2 Golden Globes. 1 more win & 2 nominations.",
"4 wins & 1 nomination.")
sub(".*\\s([0-9]+)\\snomination.*$", "\\1", awards)
Solution: A vector of character strings containing:
Won 1 Oscar., 24, 2, 3, 2, 1