Set a year range for a regression

I would like to only get the data from between 2006 - 2011 . I have tried filter(yearID >= 2006 && yearID <= 2011), but that does not work either. Is there a way that I can just get between these years?

Teams2006 <- Teams %>%
select(yearID, teamID, name, G, W, L,attendance) %>%
filter(yearID >= 2006) %>%
mutate(teamID = droplevels(teamID),
Win_Perc = W/(W + L))

I am attempting to run a regression with this data, is there perhaps a better way to do it in the regression than fixing anything above? The regression I have now is, could I sequence it here using by instead?

lm1 = lm(formula = Win_Perc ~ payroll,
data = teamPayroll2006)

can you run str(Teams) and report on the output? I'm wondering if "yearID" is a non-numeric.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.