Database Reference
In-Depth Information
How it works...
The new project directory also contains a ile named project.clj . This ile contains
metadata about the project, such as its name, version, license, and more. It also contains
a list of the dependencies that our code will use, as shown in the following snippet. The
speciications that this ile uses allow it to search Maven repositories and directories of
Clojure libraries (Clojars, https://clojars.org/ ) in order to download the project's
dependencies. Thus, it integrates well with Java's own packaging system as developed with
Maven ( http://maven.apache.org/ ) .
(defproject getting-data "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]])
In the Getting ready section of each recipe, we'll see the libraries that we need to list in the
:dependencies section of this ile. Then, when you run any lein command, it will download
the dependencies irst.
Reading CSV data into Incanter datasets
One of the simplest data formats is comma-separated values (CSV), and you'll ind that
it's everywhere. Excel reads and writes CSV directly, as do most databases. Also, because
it's really just plain text, it's easy to generate CSV iles or to access them from any
programming language.
Getting ready
First, let's make sure that we have the correct libraries loaded. Here's how the project
Leiningen ( https://github.com/technomancy/leiningen ) project.clj ile should
look (although you might be able to use more up-to-date versions of the dependencies):
(defproject getting-data "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.6.0"]
[incanter "1.5.5"]])
Downloading the example code
You can download the example code iles for all Packt topics you have
purchased from your account at http://www.packtpub.com . If you
purchased this topic elsewhere, you can visit http://www.packtpub.
com/support and register to have the iles e-mailed directly to you.
 
Search WWH ::




Custom Search