I have a data frame of sensor logs and a list of fitted models. mean(df["temp"]) returns NA with a warning, while mean(df[["temp"]]) and mean(df$temp) work. With my list, summary(models[1]) prints a short table about a list instead of the model summary I get from summary(models[[1]]).
What is the rule behind single brackets, double brackets and the dollar sign, and how do I pick the right one when the column name is stored in a variable?




