Reputation: 1
I am just beginning to learn R and I can't figure out why the header line isn't being read in my data. Below is my very simple script with the error at the end saying one of my headers does not exist.
dat = read.table("D:/Wild_South/Linville_Gorge/HWA/Data/R_HWA.txt", header = T)
dat
Treatment HWA Elevation
1 0 0.0 3072
2 0 0.0 3357
.
.
.
.
176 1 3.0 3898
177 1 3.0 3771
results = lm(HWA ~ Elevation + Treatment)
Error in eval(expr, envir, enclos) : object 'HWA' not found
Thoughts?
Upvotes: 0
Views: 471
Reputation: 189
If I understand your issue correctly, you simply need to change the code to results = lm(dat$HWA ~ dat$Elevation + dat$Treatment).
It is not the case that header line is not being read, but that the variables are not being identified correctly.
Upvotes: 4