10.2 Preliminary step: download a .csv file
To load a .csv file into R we first need a .csv file to load. The data we’ll be working with can be downloaded from GitHub. First, go to the following link (it happens to be an obscure subfolder of the wildlifeR package)
https://github.com/brouwern/wildlifeR/tree/master/inst/extdata
Next, locate the file Medley1998.csv
Click on it; a table will show up.
This table is formatted to look nice on a webpage (using some HTML that GitHub impose on the file). We want the raw file itself. To get it we need to click on the “Raw” tab.
We will then see what looks like a text document against a white background with no formatting of any kind. We can now download the file by following these steps.
Either
- Use the shortcut Control + S to “Save as” the file
Or
- Right click (on Mac:…)
- “Save link as” (or the equivalent)
Then save the file to a location you know you can find, such as
- Documents
- Desktop
- Your network profile drive
Note that if you try to “Save as…” anything else but the white-screen raw text file you will run into problems.
After you download the file, open up Excel or another spreadsheet program and open up the file to confirm that what you downloaded is just a set of numbers. I you see long lines of text you might have accidentally downloaded the HTML-formatted version of the file. Make sure you are downloading the very plain version of the file from the totally blank white screen.