Skip to content

Instantly share code, notes, and snippets.

@cs224
Created October 13, 2013 05:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cs224/6958441 to your computer and use it in GitHub Desktop.
Save cs224/6958441 to your computer and use it in GitHub Desktop.
$join does not work if the 1st element in the second dataset does not have a corresponding element in the first dataset
(ns experiment.incanter
(:require [incanter.core :as i]))
(def join-dataset-1 (i/dataset [:id :vehicle-type]
[[1 "car"]
[2 "motor-bike"]
[3 "train"]]))
;;;(i/view join-dataset-1)
(def join-dataset-2 (i/dataset [:id :number-wheels]
[[1 4]
[2 2]
[3 "many"]]))
;;;(i/view join-dataset-2)
;;; (->> (i/$join [:id :id] join-dataset-2 join-dataset-1) i/view)
(def join-dataset-3 (i/dataset [:id :number-wheels]
[;;[1 4]
[2 2]
[3 "many"]]))
;;;(i/view join-dataset-3)
;;(->> (i/$join [:id :id] join-dataset-3 join-dataset-1) i/view)
(def join-dataset-4 (i/dataset [:id :number-wheels]
[[1 4]
;;[2 2]
[3 "many"]]))
;;;(i/view join-dataset-4)
;;(->> (i/$join [:id :id] join-dataset-4 join-dataset-1) i/view)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment