Hi
and welcome to RStudio Community!
Like all programming languages, it takes some time to get up and running in R. If you're coming to R from another programming language there can also be a bit of a learning curve because things are a little different here.
You can get your data into a data.frame named df with this:
df <- data.frame(
CatA = c("A", "A", "A", "A", "B", "B", "B", "B"),
CatB = c(50, 100, 101, 888, 444, 333, 222, 111),
CatC = c(999, 454, 5, 214, 56, 24, 12, 45)
)
The R function for calculating an average is mean(). To get the mean of all the values in CatB you can say mean(df$CatB), which passes the values in the CatB variable (i.e., column) of your data.frame and returns a single value. To get only certain values of the CatB variable you can subset your data.frame, limiting the selected values to just certain observations (i.e., rows).
The RStudio web site has great resources for learning R. Have a look and you'll soon be making progress.