18 Files: Copy, Save, Import, Export, Share
At this point, you have done enough work in CODAP that you probably need to save your files. And if your class did the activity where different groups found the mean heights for males and females of particular ages, and entered them in a spreadsheet, you probably wonder how to get those into CODAP. And if you somehow want to share your work, but don’t want the person you share it with to mess it up, you will be pleased with CODAP’s sharing features. Finally, of course, you may have a file full of data that you want to get into CODAP. How do you do that?
This chapter, then, is about the mechanics of files in CODAP. The topic sounds decidedly not about content. Largely, that’s correct: it’s just stuff you need to know to make your life easier. Saving files means you do not have to type everything in. Saving means you will not have to start over again every time.
On the other hand, it should carry a whiff of data science. Data science incudes all sorts of technological actions including archiving and storing data. Saving a file may not be a data move— it doesn’t manipulate the data—but it’s essential to the whole process.
CODAP’s sharing features—described below—are a real boon for preparing a class session. You can set up a CODAP document to be exactly the way you want students to see it. When you share, CODAP essentially takes a snapshot of the file and gives you a URL that you can post. Then, when students go to that link, each student gets their own personal copy of the file to work on.
Similarly, a student can “turn in” a CODAP document by sending you a link to their file; it’s your private copy.
18.1 Saving a CODAP file
The hamburger menu—three horizontal lines in the upper-left corner of the CODAP screen—has the usual things you would find in a File menu: Open, Save, and so forth.
When you choose Save from the hamburger menu to save your CODAP file, you have two main choices: save it as a Google doc, or save it as a local file. Each has its pros and cons.
CODAP’s interface to your Google drive is a bit unorthodox. As of early 2023, the navigation is rudimentary, and there is no search feature. If you are one of us who had trouble remembering where you put your Google docs, you will keep having trouble with Google docs saved by CODAP.
The interface for local files also looks unfamiliar. If you want to save locally, click Local file and then the download button, and that brings up the familiar Save widgetry, where you can name the file and decide what folder to put it in.
18.3 Importing data
The simplest way to import data is to drop a csv file right into your CODAP window. CODAP reads the file and makes a table out of it. Ideally, the first line of the csv has the names of attributes.
If there is a lot of data—more than 5000 cases—you will see a dialog like this one:
Using the Import command
You might also notice that there is an Import item in the hamburger menu. If you choose it, you’ll see that there are two paths: Local File and URL.
Local File: Drop in or navigate to a csv or a codap file. If it’s a csv, CODAP makes a new dataset with its own table. If it’s codap, the saved CODAP file replaces the one you’re working on.
URL: Enter or drop in a URL. You can use this to put a web page into your CODAP document. Interestingly, you can also drop a URL into your document, with the same effect.
By the way, this is also how you can install a plugin. Drop the plugin’s URL into your document (or paste it into the URL box). read more about this in the plugins chapter.
But note: importing a URL will not magically make data on a web page appear in a table! For that you need techniques in this section, below.
Importing from the clipboard
If you have the data in a text file or a spreadsheet, but it would be inconvenient to save it as a csv, try this:
Select the data you want and Copy it to the clipboard. (Be sure to include the attribute names in the first line if you can.)
Then, if you want a new dataset:
- In CODAP, click on the Table icon in the toolbar.
- Choose - - new from clipboard - - in the menu that appears.
This is exactly the same as making a csv and dragging it in. If there is a lot of data, you will see the dialog (pictured above) that lets you choose how much to import.
Or, if you want to add data to an existing dataset:
- Click the “ruler” icon in the table of the dataset you want to add to.
- Choose Import Case Data from Clipboard
You will see a dialog asking if you want the clipboard to replace the data in the table or to append the clipboard data to an existing dataset.
Importing data from a web page
You will often find data you want on a web page. How do you get it into CODAP?
It’s not always easy. For one thing, people put all kinds of non-data things into tables of data on their web pages. Or they may format them strangely. That is, you may have to munge the data before it’s ready for you to use. If things are a mess after you import them, check out this chapter on preparing and cleaning data.
But if everything is good, one strategy is to select the table on the web page, copy it, then paste it into a spreadsheet (such as Google sheets). From there you can make a csv file or just go to the Table tool to import the data into CODAP.
You can also paste it into a plain text editor, and make a csv (or tab-separated) file, which you can drop into CODAP.
xxx ideas to come?
18.4 Exporting data
You can also export a csv file from CODAP. Click the ruler palette in the table. You’ll find the command there. If you have made your table hierarchical, you can choose which level to export— or you can export them all.
This is a good way to share data with somebody who isn’t using CODAP. Also, sometimes you will want to take your work from CODAP to some other program, in order to do something CODAP can’t do.