Before performing this line of code, a shape file and a dbf file needs to be found. While looking for these files, they come with a prj file. If you open this file in a text editor, you need to make sure that the coordinate system in WGS 1984. This is important because this coordinate system is what we will use with this code. Once you find this, you need to go to mapshaper.org to transform your files to topojson and a csv file. On mapshaper.org you can just drag and drop your files into the box provided and they will upload. After that you need to export them into the corresponding files: shape file to topojson in this case but there are other options as well, and dbf to csv.
Then, once you have these files, you can upload these files as attachments into observable. There is a paper clip icon on the right hand side of the browser and there is where you will select your two files to attach to the notebook.
This line of code reads in the topojson file. You have to have the files attached before you run this chunk of code.
This line of code reads in the features of the csv you attached. Then you can see what features you have in the array that is created from your previous code (topojson). You will again make sure you have this attached before you run the code and make the file name in the code is the same as the file attached.
This line of code is where you take certain features of your data and can create your own features. So in this case, I took an identifier (FIPS), and then deaths from COVID and confirmed cases of covid to see what the percentages were for each county in Pennsylvania. If you want your data to be a number instead of a string you need to put a "+" sign in front of it if you use the .test() so you can do more things with the feature if it is in fact a numerical value.
This does the same as above but separates the death percentage with confirmed cases for future use in the neck chunk of code so it can be worked with easier.