I am very new to R studio, may be this is a very basic question but I am really not understanding what's going on. Can someone please explain. Thanks in advance.

So, I am trying to fit a model and then use anova type 2. But while doing this, I am getting an error: Error: $ operator is invalid for atomic vectors

My code is:

data <- read.table("breadwrapper.txt",header=TRUE)

y <- data$Y

x1 <- data$X1

x2 <- data$X2

x3 <- data$X3

ModelA <- lm(y ~ x1+x2+x3, data = data)

summary(ModelA)

ModelA$coefficients

anova(ModelA, type=2)

I am using a local data file. What should I do further?