In R, we'd refer to kJ/mol
in your table as a column or variable.
Without a for loop, you can quickly get the mean of a column with
mean(data$`kJ/mol`)
$
is a shorthand for extracting named elements of a list. More details at https://r4ds.had.co.nz/vectors.html?q=$%20#subsetting-1
With the tidyverse, you might approach a problem like this with
library(dplyr)
data %>%
summarize(
mean = mean(`kJ/mol`)
)
Since this is an course assignment, I'm not going to directly answer your question, but I will point out that for loops in R work similarly, but differently to the code you set up. Here's some details on how to get started.
Also, it's helpful and tidy to format your code into code chunks when interacting with folks on forums like this.. Details on how to do that here: FAQ: How to format your code
People also like to see coding questions like this in the form of reproducible examples (reprex for short). Details on how to create those here, FAQ: What's a reproducible example (`reprex`) and how do I do one?