I want to extract the fstatistic value from summary(lm()). So far the only way I’ve found is
summary(lm(this_vector ~ that_vector))["fstatistic"][[1]][1]
Is there a less verbose way to get that cell value? The question is a bit pedantic but I thought the answer might provide some interesting info on how to use R lists.
Try either of these:
["fstatistic"]returns a list with elements that have names that match what’s inside the single brackets, so you need the[[1]]to get the first element. Double brackets return the element itself, as does using the$notation.