From 280829eaeced603efdfd6114bc5e17ad822886b4 Mon Sep 17 00:00:00 2001 From: AJ Rossini Date: Thu, 17 Sep 2009 16:02:43 +0200 Subject: [PATCH] working through an R-based example to verify things work. Signed-off-by: AJ Rossini --- Data/trees.Rt | 34 ++++++++++++++++++++++++++++++++++ Data/trees.csv | 32 ++++++++++++++++++++++++++++++++ TODO.lisp | 2 +- ls-demo.lisp | 42 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 Data/trees.Rt create mode 100644 Data/trees.csv diff --git a/Data/trees.Rt b/Data/trees.Rt new file mode 100644 index 0000000..1ecdc09 --- /dev/null +++ b/Data/trees.Rt @@ -0,0 +1,34 @@ + +R version 2.9.2 (2009-08-24) +Copyright (C) 2009 The R Foundation for Statistical Computing +ISBN 3-900051-07-0 + +R is free software and comes with ABSOLUTELY NO WARRANTY. +You are welcome to redistribute it under certain conditions. +Type 'license()' or 'licence()' for distribution details. + + Natural language support but running in an English locale + +R is a collaborative project with many contributors. +Type 'contributors()' for more information and +'citation()' on how to cite R or R packages in publications. + +Type 'demo()' for some demos, 'help()' for on-line help, or +'help.start()' for an HTML browser interface to help. +Type 'q()' to quit R. + +> options(STERM='iESS', editor='emacsclient') +> data(trees) +> summary(trees) + Girth Height Volume + Min. : 8.30 Min. :63 Min. :10.20 + 1st Qu.:11.05 1st Qu.:72 1st Qu.:19.40 + Median :12.90 Median :76 Median :24.20 + Mean :13.25 Mean :76 Mean :30.17 + 3rd Qu.:15.25 3rd Qu.:80 3rd Qu.:37.30 + Max. :20.60 Max. :87 Max. :77.00 +> write.csv(trees,file="Data/trees.csv") +> q() +Save workspace image? [y/n/c]: n + +Process R finished at Wed Sep 2 07:48:54 2009 diff --git a/Data/trees.csv b/Data/trees.csv new file mode 100644 index 0000000..b9fdd0b --- /dev/null +++ b/Data/trees.csv @@ -0,0 +1,32 @@ +"","Girth","Height","Volume" +"1",8.3,70,10.3 +"2",8.6,65,10.3 +"3",8.8,63,10.2 +"4",10.5,72,16.4 +"5",10.7,81,18.8 +"6",10.8,83,19.7 +"7",11,66,15.6 +"8",11,75,18.2 +"9",11.1,80,22.6 +"10",11.2,75,19.9 +"11",11.3,79,24.2 +"12",11.4,76,21 +"13",11.4,76,21.4 +"14",11.7,69,21.3 +"15",12,75,19.1 +"16",12.9,74,22.2 +"17",12.9,85,33.8 +"18",13.3,86,27.4 +"19",13.7,71,25.7 +"20",13.8,64,24.9 +"21",14,78,34.5 +"22",14.2,80,31.7 +"23",14.5,74,36.3 +"24",16,72,38.3 +"25",16.3,77,42.6 +"26",17.3,81,55.4 +"27",17.5,82,55.7 +"28",17.9,80,58.3 +"29",18,80,51.5 +"30",18,80,51 +"31",20.6,87,77 diff --git a/TODO.lisp b/TODO.lisp index c78f4a5..1d5b265 100644 --- a/TODO.lisp +++ b/TODO.lisp @@ -1,6 +1,6 @@ ;;; -*- mode: lisp -*- -;;; Time-stamp: <2009-08-27 07:52:57 tony> +;;; Time-stamp: <2009-09-15 06:51:08 tony> ;;; Creation: <2008-09-08 08:06:30 tony> ;;; File: TODO.lisp ;;; Author: AJ Rossini diff --git a/ls-demo.lisp b/ls-demo.lisp index 1327a35..a51911b 100644 --- a/ls-demo.lisp +++ b/ls-demo.lisp @@ -3,7 +3,7 @@ ;;; See COPYRIGHT file for any additional restrictions (BSD license). ;;; Since 1991, ANSI was finally finished. Edited for ANSI Common Lisp. -;;; Time-stamp: <2009-08-18 08:07:56 tony> +;;; Time-stamp: <2009-09-04 18:00:16 tony> ;;; Creation: sometime in 2006... ;;; File: ls-demo.lisp ;;; Author: AJ Rossini @@ -24,7 +24,7 @@ ;; a bit of infrastructure for beginners (defparameter *my-cls-homedir* - "/media/disk/Desktop/sandbox/CLS.git/") + "/media/disk/Desktop/sandbox/CLS.git/") ;; CHANGE THIS TO LOCALIZE!! (concatenate 'string *my-cls-homedir* "Data/example.csv") ;; implies (defun localized-pathto (x) @@ -139,6 +139,7 @@ ;; *my-df-5* + (defparameter *mat-1* (make-matrix 3 3 :initial-contents #2A((2d0 3d0 4d0) (3d0 2d0 4d0) (4d0 4d0 5d0)))) @@ -1304,3 +1305,40 @@ my.lib (typep (rand 10 20) 'array) |# + +;;;;;;;;;;;;;;;;; =========== + +(defparameter *my-df-trees* + (make-instance 'dataframe-array + :storage + (listoflist->array + (transpose-listoflist + (rsm.string:file->number-table + (localized-pathto "Data/trees.csv")))) + :doc "This is an interesting dataframe-array that currently fails")) + +;; *my-df-trees* + +(defparameter *my-df-trees2* + (make-instance 'dataframe-array + :storage + (listoflist->array + (transpose-listoflist + (rsm.string:file->number-table + (localized-pathto "Data/trees.csv") + :delims ","))) + :doc "This is an interesting dataframe-array that currently fails")) +;; *my-df-trees2* +;; (dataset *my-df-trees2*) + +(defparameter *my-df-trees2a* + (make-instance 'dataframe-array + :storage + (listoflist->array + (rsm.string:file->number-table + (localized-pathto "Data/trees.csv") + :delims ",")) + :doc "This is an interesting dataframe-array that currently fails")) + +;; *my-df-trees2a* +;; (dataset *my-df-trees2a*) -- 2.11.4.GIT