Database Reference
In-Depth Information
2. If we have a header row in the CSV ile, then we include :header true in the call to
read-dataset :
user=> (read-dataset "data/RestAreasCombined(Ver.BJ)-headers.csv"
:header true)
| :longitude | :latitude | :name
| :codes |
|------------+-----------+--------------------------------------+-
---------------------------|
| -67.834062 | 46.141129 | REST AREA-FOLLOW SIGNS SB I-95 MM305 |
RR, PT, Pets, HF |
| -67.845906 | 46.138084 | REST AREA-FOLLOW SIGNS NB I-95 MM305 |
RR, PT, Pets, HF |
| -68.498471 | 45.659781 | TURNOUT NB I-95 MM249 |
Scenic Vista-NO FACILITIES |
| -68.534061 | 45.598464 | REST AREA SB I-95 MM240 |
RR, PT, Pets, HF |
| -68.539034 | 45.594001 | REST AREA NB I-95 MM240 |
RR, PT, Pets, HF |
How it works…
Together, Clojure and Incanter make a lot of common tasks easy, which is shown in the How to
do it section of this recipe.
We've taken some external data, in this case from a CSV ile, and loaded it into an Incanter
dataset. In Incanter, a dataset is a table, similar to a sheet in a spreadsheet or a database
table. Each column has one ield of data, and each row has an observation of data. Some
columns will contain string data (all of the columns in this example did), some will contain
dates, and some will contain numeric data. Incanter tries to automatically detect when a
column contains numeric data and coverts it to a Java int or double . Incanter takes away a
lot of the effort involved with importing data.
There's more…
For more information about Incanter datasets, see Chapter 6 , Working with Incanter Datasets .
 
Search WWH ::




Custom Search