Hi, and welcome!
Please take a look at the FAQ: What's a reproducible example (`reprex`) and how do I do one? It really helps to get quick and useful answers.
Also, take a look at this free introduction: https://r4ds.had.co.nz
Another very helpful resource is the second edition of the R Cookbook https://rc2e.com