Hey so I've ran the following code from a dataset I loaded. I keep getting the same error on the last 2 lines and am not sure how to fix it. Any suggestions?
Your code hasn't actually created an object named data, so R is falling back to the function data() (used for loading built-in datasets). A function is called a "closure" by R.
Were you maybe adapting this code from an example somewhere? I'm not quite sure what you're doing here and I can't run your code (it's not reproducible as-is, since it relies on files local to your system), but I suspect you need to have the name of your data frame pitcher in the place of data.
To learn more about how to make your code questions as easy as possible to answer, take a look at this FAQ:
One small tip, unrelated to your question: using attach() on a data frame can create a lot of confusion, since it basically adds invisible variable names to your session. This code isn't even gaining any convenience from attach()-ing, since you're using subset() (which already lets you use bare column names) or fully qualifying your columns (e.g., pitcher$WAR). So I'd recommend skipping the attach(). It's likely to create more pain than it's worth.