The data I used was from this website: https://www.eia.gov/electricity/data/state/
Make sure to choose the spreadsheet that says "U.S. Electric Power Industry Estimated Emissions by State".
Here is a direct link to the spreadsheet if you prefer: https://www.evl.uic.edu/aej/424/annual_generation_state.csv
There is no need to make any changes to the file outside of RStudio. In fact, I make several modifications to the data in my source code. I then turned the data into stacked bar charts, line charts, tables, and heat maps.
This is what the original spreadsheet should look like.
I got rid of the commas in the generation data and also there were some missing states in 2003 that I removed. I also removed some extra energy sources such as "Other Biomass, Other Gases, etc.". Furthermore, to simplify the data, I removed the negative values in the spreadsheet.