mirror of https://github.com/Chizi123/.emacs.d.git

Chizi123
2018-11-18 76bbd07de7add0f9d13c6914f158d19630fe2f62
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
;ELC
;;; Compiled
;;; in Emacs version 26.1
;;; with all optimizations.
 
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
 
;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
(byte-code "\300\301!\210\300\302!\207" [require cl-lib ob] 2)
#@30 R-specific header arguments.
(defconst org-babel-header-args:R '((width . :any) (height . :any) (bg . :any) (units . :any) (pointsize . :any) (antialias . :any) (quality . :any) (compression . :any) (res . :any) (type . :any) (family . :any) (title . :any) (fonts . :any) (version . :any) (paper . :any) (encoding . :any) (pagecentre . :any) (colormodel . :any) (useDingbats . :any) (horizontal . :any) (results (file list vector table scalar verbatim) (raw html latex org code pp drawer) (replace silent none append prepend) (output value graphics))) (#$ . 471))
#@132 Header args which are safe for R babel blocks.
 
See `org-babel-safe-header-args' for documentation of the format of
this variable.
(defconst ob-R-safe-header-args (append org-babel-safe-header-args '(:width :height :bg :units :pointsize :antialias :quality :compression :res :type :family :title :fonts :version :paper :encoding :pagecentre :colormodel :useDingbats :horizontal)) (#$ . 1042))
(defvar org-babel-default-header-args:R nil)
(byte-code "\300\301\302\303#\210\304\305\306\307\310DD\311\312\313\314\315\316\317&    \207" [put org-babel-default-header-args:R safe-local-variable #[257 "\211<\205    \300\301\"\207" [cl-every #[257 "\211:\205    \301\"\207" [ob-R-safe-header-args org-babel-one-header-arg-safe-p] 4 "\n\n(fn PAIR)"]] 4 "\n\n(fn VALUE)"] custom-declare-variable org-babel-R-command funcall function #[0 "\300\207" [#1="R --slave --no-save"] 1 #1#] "Name of command to use for executing R code." :group org-babel :version "24.1" :type string] 10)
#@13 
 
(fn INFO)
(defalias 'org-babel-edit-prep:R #[257 "\300\3018\236A\211\205\302\303\"\205\304\303\"\205\305\306\"\207" [:session 2 string-prefix-p "*" string-suffix-p org-babel-R-initiate-session nil] 5 (#$ . 2015)])
#@127 R code used to transfer a table defined as a variable from org to R.
 
This function is used when the table contains a header.
(defconst ob-R-transfer-variable-table-with-header "%s <- local({\n     con <- textConnection(\n       %S\n     )\n     res <- utils::read.table(\n       con,\n       header    = %s,\n       row.names = %s,\n       sep       = \"\\t\",\n       as.is     = TRUE\n     )\n     close(con)\n     res\n   })" (#$ . 2248))
#@135 R code used to transfer a table defined as a variable from org to R.
 
This function is used when the table does not contain a header.
(defconst ob-R-transfer-variable-table-without-header "%s <- local({\n     con <- textConnection(\n       %S\n     )\n     res <- utils::read.table(\n       con,\n       header    = %s,\n       row.names = %s,\n       sep       = \"\\t\",\n       as.is     = TRUE,\n       fill      = TRUE,\n       col.names = paste(\"V\", seq_len(%d), sep =\"\")\n     )\n     close(con)\n     res\n   })" (#$ . 2698))
#@102 Expand BODY according to PARAMS, return the expanded body.
 
(fn BODY PARAMS &optional GRAPHICS-FILE)
(defalias 'org-babel-expand-body:R #[770 "\300\301\302\303\236A\205\303\236AC\304!C\305\236A\205$\305\236AC$\306#\207" [mapconcat identity append :prologue org-babel-variable-assignments:R :epilogue "\n"] 11 (#$ . 3243)])
#@104 Execute a block of R code.
This function is called by `org-babel-execute-src-block'.
 
(fn BODY PARAMS)
(defalias 'org-babel-execute:R #[514 "\212\300\236A\301\236A\302\303\236A\"\304\300\236\235\205\305!\211?\205$\306\236A?\205.\307\236A\310#C\311\312\203K\313\314\f\"C\315C#\202L\316#\262\317\n\320\232\206g\321\322\236A    \"\320\232\206w\321\323\236A    \"&?\205\211\266\210)\207" [:result-params :result-type org-babel-R-initiate-session :session "graphics" org-babel-graphical-output-file :colnames :rownames org-babel-expand-body:R mapconcat identity append org-babel-R-construct-graphics-device-call "},error=function(e){plot(x=-1:1, y=-1:1, type='n', xlab='', ylab='', axes=FALSE); text(x=0, y=0, labels=e$message, col='red'); paste('ERROR', e$message, sep=' : ')}); dev.off()" "\n" org-babel-R-evaluate "yes" org-babel-pick-name :colname-names :rowname-names] 18 (#$ . 3586)])
#@93 Prepare SESSION according to the header arguments specified in PARAMS.
 
(fn SESSION PARAMS)
(defalias 'org-babel-prep-session:R #[514 "\301\"\302!\303!\204\304\305\"\210\306 \307\310\311\312\313!\314\"\315$\216rq\210\212\316\317\307\320\321\312\313!\322\"\323\324%\"\210,\210\207" [comint-input-filter org-babel-R-initiate-session org-babel-variable-assignments:R org-babel-comint-buffer-livep error "Buffer %s does not exist or has no process" match-data make-byte-code 0 "\301\300\302\"\207" vconcat vector [set-match-data evaporate] 3 #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] mapc 257 "\301\210\211c\210\302\303\304\"\210\305\300!\207" [1 comint-send-input nil t org-babel-comint-wait-for-output] 4 "\n\n(fn VAR)"] 12 (#$ . 4521)])
#@51 Load BODY into SESSION.
 
(fn SESSION BODY PARAMS)
(defalias 'org-babel-load-session:R #[771 "\300 \301\302\303\304\305!\306\"\307$\216\310\"r\211q\210\311\312p!!b\210\313!c\210)\211\262)\207" [current-window-configuration make-byte-code 0 "\301\300!\207" vconcat vector [set-window-configuration] 2 org-babel-prep-session:R process-mark get-buffer-process org-babel-chomp] 10 (#$ . 5279)])
#@75 Return list of R statements assigning the block's variables.
 
(fn PARAMS)
(defalias 'org-babel-variable-assignments:R #[257 "\300!\301\302\303\304\305\306!\307\"\310\311%\301\302\303\312\305\306        \"\313\"\314\315%\316\317GS\"\"\"\207" [org-babel--get-vars mapcar make-byte-code 257 "\301@A\302\300\236A\303\232\304\300\236A\303\232$\207" vconcat vector [org-babel-R-assign-elisp :colnames "yes" :rownames] 7 "\n\n(fn PAIR)" "\211\3018@\302\3018A\303\300\236A8A\304\300\236A8A#B\207" [org-babel-reassemble-table :colname-names :rowname-names] 8 "\n\n(fn I)" number-sequence 0] 12 (#$ . 5680)])
#@40 Quote field S for export to R.
 
(fn S)
(defalias 'org-babel-R-quote-tsv-field #[257 "\211;\203\300\301\302\303\300\"\304#\300Q\207\305\306\"\207" ["\"" mapconcat identity split-string "\"\"" format "%S"] 7 (#$ . 6291)])
#@109 Construct R code assigning the elisp VALUE to a variable named NAME.
 
(fn NAME VALUE COLNAMES-P ROWNAMES-P)
(defalias 'org-babel-R-assign-elisp #[1028 "<\203n\303\304\305\306\"\"\211\203\307\310\"\202\311\203$\307\312\"\202%\311@<\204/C\262\313\314\"A@\315=\204A\203E\316\202F\317\203N\320\202O\321U\203`\322 %\202k\322     \n&\266\203\207\250\203~\322\323\324!\325P#\207\326!\203\212\322\323#\207;\203\260\322\327\330\211\203\243\331\311G\n$\210\202\253\332\311G\330$\210\266\202#\207\322\327\333!#\207" [ob-R-transfer-variable-table-with-header ob-R-transfer-variable-table-without-header org-rm-props mapcar length cl-remove-if-not sequencep apply max 0 min orgtbl-to-tsv (:fmt org-babel-R-quote-tsv-field) hline "TRUE" "FALSE" "1" "NULL" format "%s <- %s" number-to-string "L" floatp "%s <- %S" nil remove-text-properties set-text-properties prin1-to-string] 17 (#$ . 6522)])
#@75 If there is not a current R process then create one.
 
(fn SESSION PARAMS)
(defalias 'org-babel-R-initiate-session #[514 "\303\230?\205{\206\f\304\305\300!\205\205\306\236A?\307!\203&\211\202x\310 \311\312\313\314\315!\316\"\317$\216\320!\203=q\210\321\322!\210\323 \210\324    \206J\n!\325\326\"\203Y\327!\210\202K\210\330\331!\203g\332!\202r;\203p\202r\332 !\210p)\262)\262\207" [ess-ask-for-ess-directory ess-local-process-name ess-current-process-name "none" "*R*" boundp :dir org-babel-comint-buffer-livep current-window-configuration make-byte-code 0 "\301\300!\207" vconcat vector [set-window-configuration] 2 get-buffer require ess R get-process process-get callbacks ess-wait-for-process rename-buffer bufferp buffer-name] 10 (#$ . 7471)])
#@140 Associate R code buffer with an R session.
Make SESSION be the inferior ESS process associated with the
current code buffer.
 
(fn SESSION)
(defalias 'org-babel-R-associate-session #[257 "\301\302!!\303 \207" [ess-local-process-name process-name get-buffer-process ess-make-buffer-current] 4 (#$ . 8256)])
#@359 An alist mapping graphics file types to R functions.
 
Each member of this list is a list with three members:
1. the file extension of the graphics file, as an elisp :keyword
2. the R graphics device function to call to generate such a file
3. the name of the argument to this function which specifies the
   file to write to (typically "file" or "filename")
(defvar org-babel-R-graphics-devices '((:bmp "bmp" "filename") (:jpg "jpeg" "filename") (:jpeg "jpeg" "filename") (:tikz "tikz" "file") (:tiff "tiff" "filename") (:png "png" "filename") (:svg "svg" "file") (:pdf "pdf" "file") (:ps "postscript" "file") (:postscript "postscript" "file")) (#$ . 8570))
#@66 Construct the call to the graphics device.
 
(fn OUT-FILE PARAMS)
(defalias 'org-babel-R-construct-graphics-device-call #[514 "\301\302!\303\304P!\236\206\305\236\306\236A\307\211A@\262\3108\262\311\312\313\314\315\316 !\317\"\320\321%\322#\262\323\324 \203F\325\202G\322    \206M\322&\207" [org-babel-R-graphics-devices (:width :height :bg :units :pointsize :antialias :quality :compression :res :type :family :title :fonts :version :paper :encoding :pagecentre :colormodel :useDingbats :horizontal) file-name-extension intern ":" :png :R-dev-args nil 2 mapconcat make-byte-code 257 "\211@\300\235\203\301\302\303@!\304\305OA#\207\306\207" vconcat vector [format ",%s=%S" symbol-name 1 nil #1=""] 6 "\n\n(fn PAIR)" #1# format "%s(%s=\"%s\"%s%s%s); tryCatch({" ","] 16 (#$ . 9234)])
(defconst org-babel-R-eoe-indicator "'org_babel_R_eoe'")
(defconst org-babel-R-eoe-output "[1] \"org_babel_R_eoe\"")
#@293 A template for an R command to evaluate a block of code and write the result to a file.
 
Has four %s escapes to be filled in:
1. Row names, "TRUE" or "FALSE"
2. Column names, "TRUE" or "FALSE"
3. The code to be run (must be an expression, not a statement)
4. The name of the file to write to
(defconst org-babel-R-write-object-command "{\n    function(object,transfer.file) {\n        object\n        invisible(\n            if (\n                inherits(\n                    try(\n                        {\n                            tfile<-tempfile()\n                            write.table(object, file=tfile, sep=\"\\t\",\n                                        na=\"nil\",row.names=%s,col.names=%s,\n                                        quote=FALSE)\n                            file.rename(tfile,transfer.file)\n                        },\n                        silent=TRUE),\n                    \"try-error\"))\n                {\n                    if(!file.exists(transfer.file))\n                        file.create(transfer.file)\n                }\n            )\n    }\n}(object=%s,transfer.file=\"%s\")" (#$ . 10168))
#@98 Evaluate R code in BODY.
 
(fn SESSION BODY RESULT-TYPE RESULT-PARAMS COLUMN-NAMES-P ROW-NAMES-P)
(defalias 'org-babel-R-evaluate #[1542 "\203\300&\207\301%\207" [org-babel-R-evaluate-session org-babel-R-evaluate-external-process] 13 (#$ . 11319)])
#@268 Evaluate BODY in external R process.
If RESULT-TYPE equals `output' then return standard output as a
string.  If RESULT-TYPE equals `value' then return the value of the
last statement in BODY, as elisp.
 
(fn BODY RESULT-TYPE RESULT-PARAMS COLUMN-NAMES-P ROW-NAMES-P)
(defalias 'org-babel-R-evaluate-external-process #[1285 "\302\267\202\262\303\304!\305\306    \203\307\202\310\203(\203$\311\202)\307\202)\310\306\312 \"\313\314\"%\"\210\315\316\235?\205\247\317\235\204\201\320\235\204\201\321\235\204\201\322\235\204\201\323\235\204\201\324\235\204\201\325\235\204{\326\235\204{\327\235\204{\330\235\203\243\331\235\204\243\332\333!r\211q\210\334\335\336\337\340!\341\"\342$\216\343!\210\344\345 \346\"*\262\202\247\347\350\"\262\"\207\305\"\207\351\207" [org-babel-R-command org-babel-R-write-object-command #s(hash-table size 2 test eql rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (value 6 output 172)) org-babel-temp-file "R-" org-babel-eval format "TRUE" "FALSE" "NA" "{function ()\n{\n%s\n}}()" org-babel-process-file-name noquote org-babel-R-process-value-result "none" "scalar" "verbatim" "html" "code" "pp" "file" "output" "raw" "org" "drawer" "table" generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205    \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 insert-file-contents org-babel-chomp buffer-string "\n" org-babel-import-elisp-from-file (16) nil] 16 (#$ . 11595)])
#@265 Evaluate BODY in SESSION.
If RESULT-TYPE equals `output' then return standard output as a
string.  If RESULT-TYPE equals `value' then return the value of the
last statement in BODY, as elisp.
 
(fn SESSION BODY RESULT-TYPE RESULT-PARAMS COLUMN-NAMES-P ROW-NAMES-P)
(defalias 'org-babel-R-evaluate-session #[1542 "\306\267\202\221\307\310!r\211q\210\311\312\313\314\315!\316\"\317$\216\320!c\210\321\322!!\323\324\323!\210,\210\325\326!\327\330\n\203@\331\202A\332\203S\203O\333\202T\331\202T\332\334\335    \336\"%#\210\337\340\235?\205\316\341\235\204\250\342\235\204\250\343\235\204\250\344\235\204\250\345\235\204\250\346\235\204\250\347\235\204\242\350\235\204\242\351\235\204\242\352\235\203\312\353\235\204\312\307\310!r\211q\210\311\312\313\314\315!\354\"\317$\216\355!\210\320\356 \357\"*\262\202\316\360\361\"\262\"\207\362\320\363\364\323\365\366\365\367\370!\204\351\371\372\"\210\373 \311\312\374\314\315!\375\"\376$\216rq\210\212\377\201CC\311\201D\201E\314\315!\201F\"\201G\201H%\fB\323\201I\322p!!b\210`d{\262|\266\362\320 D\357#c\210\201J \210@b\210\212\201K\201LA!\323\201M#\205a\201KB\323\201M#)\204p\201N\322p!!\210\202A\201I\322p!!b\210\211c\210\201O\242B\")\266\202,\262\"\"\"!\357#\207\323\207" [ess-eval-visibly-p ess-local-process-name org-babel-R-write-object-command comint-input-filter comint-output-filter-functions org-babel-R-eoe-indicator #s(hash-table size 2 test eql rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (value 6 output 211)) generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205    \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 org-babel-chomp process-name get-buffer-process nil ess-eval-buffer org-babel-temp-file "R-" org-babel-comint-eval-invisibly-and-wait-for-file format "TRUE" "FALSE" "NA" ".Last.value" org-babel-process-file-name noquote org-babel-R-process-value-result "none" "scalar" "verbatim" "html" "code" "pp" "file" "output" "raw" "org" "drawer" "table" [buffer-name kill-buffer] insert-file-contents buffer-string "\n" org-babel-import-elisp-from-file (16) mapconcat butlast delq mapcar #[257 "\211G\300V\205\211\207" [0] 3 "\n\n(fn LINE)"] #[257 "\300\301\302\303\"@\"\203\211\304\225\305O\207\207" [string-match "^\\([>+.]\\([ ][>.+]\\)*[ ]\\)" split-string "\n" 1 nil] 6 "\n\n(fn LINE)"] org-babel-comint-buffer-livep error "Buffer %s does not exist or has no process" match-data "\301\300\302\"\207" [set-match-data evaporate] 3 #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] comint-last-input-end org-babel-R-eoe-output comint-prompt-regexp "" 257 "\300\211\242P\240\207" [] 4 "\n\n(fn TEXT)" process-mark inferior-ess-send-input re-search-forward regexp-quote t accept-process-output split-string] 23 (#$ . 13065)])
#@128 R-specific processing of return value.
Insert hline if column names in output have been requested.
 
(fn RESULT COLUMN-NAMES-P)
(defalias 'org-babel-R-process-value-result #[514 "\211\203\f@\300ABB\207\207" [hline] 5 (#$ . 15883)])
(provide 'ob-R)