Is this data organized as a dataframe? If so, how are the rows defined? If your data were organized this way:
State County Year Attainment
State1 County1 1 1
State1 County1 2 0
State1 County1 3 1
State1 County1 4 1
State1 County2 1 1
State1 County2 2 1
...
Then it would be possible to get the kind of summary data you're looking for with 1 line of code. Hopefully your notation means that your data is organized like this:
State County Yr1 Yr2 Yr3 Yr4
State1 County1 1 0 1 1
State1 County2 1 1 1 1
Use melt() from the reshape package to get from this format to the one laid out above.
new.df <- melt(df, id = 1:2)
It'll call the Year variable variable and the Attainment variable value. Now, with clever use of the cast function, also from the reshape package, you can get the summary you want.
counties <- cast(new.df, State ~ value, fun = length)
head(counties)
However, if your data is organized so that every state, county and year is a column, and it's only 1 row long, I think your best next step would be to reformat the data outside of R so that it looks at least like my second example.