6
function makeCodes () {
7
histcalcoptions = ", breaks=";
10
varname = getValue ("varname");
12
histbreaks = getValue ("histbreaksFunction");
13
headeroptions += ', "Break points", "';
14
if (histbreaks == "cells") {
15
histcalcoptions += getValue ("histbreaks_ncells");
16
headeroptions += 'Approximately ' + getValue ("histbreaks_ncells") + ' cells"';
17
} else if (histbreaks == "int") {
18
histcalcoptions += "seq (floor (min (" + varname + ", na.rm=TRUE))-0.5, ceiling (max (" + varname + ", na.rm=TRUE))+0.5)";
19
headeroptions += 'Integers"';
21
else if (histbreaks == "vec") {
22
histcalcoptions += "(function(x) {y = extendrange(x,f=0.1); seq(from=y[1], to=y[2], length=" + getValue ("histbreaks_veclength") + ")})(" + varname + ")";
23
headeroptions += 'Equally spaced vector of length ' + getValue ("histbreaks_veclength") + '"';
25
histcalcoptions += "\"" + histbreaks + "\"";
26
headeroptions += histbreaks + '"';
29
right = getValue ("rightclosed");
31
headeroptions += ', "Right closed", "FALSE"';
32
histcalcoptions += ", right=FALSE";
34
headeroptions += ', "Right closed", "TRUE"';
37
inclowest = getValue ("include_lowest");
39
headeroptions += ', "Include in lowest cell", "FALSE"';
40
histcalcoptions += ", include.lowest=FALSE";
42
headeroptions += ', "Include in lowest cell", "TRUE"';
45
freq = getValue ("freq");
47
histplotoptions += ", freq=FALSE";
48
headeroptions += ', "Scale", "Density"';
50
headeroptions += ', "Scale", "Frequency"';
53
addbars = getValue ("addtoplot");
54
if (addbars) histplotoptions += ", add=TRUE";
56
labels = getValue ("barlabels");
57
if (labels) histplotoptions += ", labels=TRUE";
59
histlty = getValue ("histlinetype");
60
histplotoptions += ", lty=" + "\"" + histlty + "\"";
62
if (histlty != "blank") {
63
density = getValue ("density");
64
histplotoptions += ", density=" + density;
65
if (density > 0) histplotoptions += ", angle=" + getValue ("angle");
66
if (getValue ("doborder")) histbordercol = getValue ("histbordercol.code.printout");
67
else histbordercol = ", border=FALSE";
71
if (getValue ("usefillcol")) histfillcol = getValue ("histfillcol.code.printout");
73
histplotoptions += histbordercol + histfillcol;
76
function preprocess () {
82
function calculate () {
85
echo (histcalcoptions);
88
function printout () {
91
echo (histplotoptions);