;ELC   
;;; Compiled
;;; in Emacs version 24.5.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.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(require 'ob)
#@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))) (#$ . 424))
#@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)) (#$ . 995))
(defvar org-babel-default-header-args:R nil)
(byte-code "\300\301\302\303#\210\304\305\306\307\310\311\312\313\314\315&	\207" [put org-babel-default-header-args:R safe-local-variable #[(value) "<\205	 \301\302\"\207" [value org-every #[(pair) ":\205	 \302	\"\207" [pair ob-R-safe-header-args org-babel-one-header-arg-safe-p] 3]] 3] custom-declare-variable org-babel-R-command "R --slave --no-save" "Name of command to use for executing R code." :group org-babel :version "24.1" :type string] 10)
(defalias 'org-babel-edit-prep:R #[(info) "\303\304\3058\"A\211\205 \306\307	\"\205 \310 \311\216\312	\313\"*)\207" [info session save-match-data-internal assoc :session 2 string-match "^\\*\\(.+?\\)\\*$" match-data ((byte-code "\301\302\"\207" [save-match-data-internal set-match-data evaporate] 3)) org-babel-R-initiate-session nil] 5])
#@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   })" (#$ . 2239))
#@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   })" (#$ . 2689))
#@60 Expand BODY according to PARAMS, return the expanded body.
(defalias 'org-babel-expand-body:R #[(body params &optional graphics-file) "\302\303\304\305\306\"A\205 \305\306\"AC\307!	C\305\310\"A\205$ \305\310\"AC$\311#\207" [params body mapconcat identity append assoc :prologue org-babel-variable-assignments:R :epilogue "\n"] 9 (#$ . 3233)])
#@86 Execute a block of R code.
This function is called by `org-babel-execute-src-block'.
(defalias 'org-babel-execute:R #[(body params) "\212\306\307\"A\306\310\"A\311\306\312\"A\"\306\313\"A\306\314\"A\315\307\236\235\205- \316!\317#C\320\321\203O \322\323\"C\324C#\202Q \325#)\326\n	\f\327\232\206j \330\306\331\"A\f\"\327\232\206x \330\306\332\"A\"&?\205\204 .	\207" [params result-params result-type session colnames-p rownames-p assoc :result-params :result-type org-babel-R-initiate-session :session :colnames :rownames "graphics" org-babel-graphical-output-file 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 graphics-file body inside full-body result] 10 (#$ . 3588)])
#@72 Prepare SESSION according to the header arguments specified in PARAMS.
(defalias 'org-babel-prep-session:R #[(session params) "\305	\"\306	!\307!\204 \310\311\"\210\312 \313\216rq\210\314\315\316\n\"\210,*\207" [session params var-lines save-match-data-internal 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 ((byte-code "\301\302\"\207" [save-match-data-internal set-match-data evaporate] 3)) #[(input) "\300\207" [nil] 1] mapc #[(var) "\302\210c\210\303\304\305\"\210\306	!\207" [var session 1 comint-send-input nil t org-babel-comint-wait-for-output] 3]] 3 (#$ . 4621)])
#@25 Load BODY into SESSION.
(defalias 'org-babel-load-session:R #[(session body params) "\305 \306\216\307	\n\"rq\210\310\311p!!b\210\312\f!c\210)+\207" [#1=#:wconfig session params buffer body current-window-configuration ((set-window-configuration #1#)) org-babel-prep-session:R process-mark get-buffer-process org-babel-chomp] 3 (#$ . 5341)])
#@62 Return list of R statements assigning the block's variables.
(defalias 'org-babel-variable-assignments:R #[(params) "\302\303\304\305\"\"\302\306\302\307\310\311	GS\"\"\")\207" [params vars mapcar cdr org-babel-get-header :var #[(pair) "\302@A\303\304	\"A\305\232\303\306	\"A\305\232$\207" [pair params org-babel-R-assign-elisp assoc :colnames "yes" :rownames] 7] #[(i) "	8@\303	8A\304\305\n\"A8A\304\306\n\"A8A#B\207" [i vars params org-babel-reassemble-table assoc :colname-names :rowname-names] 8] org-number-sequence 0] 7 (#$ . 5693)])
#@32 Quote field S for export to R.
(defalias 'org-babel-R-quote-tsv-field #[(s) ";\203 \301\302\303\304\301\"\305#\301Q\207\306\307\"\207" [s "\"" mapconcat identity split-string "\"\"" format "%S"] 6 (#$ . 6247)])
#@70 Construct R code assigning the elisp VALUE to a variable named NAME.
(defalias 'org-babel-R-assign-elisp #[(name value colnames-p rownames-p) "<\203z \306\307\310\311\"\"\211\203 \312\302	\"\202 \313	\203% \312\303	\"\202& \313@<\2040 C\314\315\"A@\316=\204@ \f\203D \317\202E \320\203M \321\202N \322 \nU\203i \323!\" %\202w \323#\" \n&.\207\250\203\212 \323\324\"\325!\326P#\207\327!\203\227 \323\324\"#\207;\203\333 \323\330\"\331$%\332\333!\203\271 \333\313%G\331%$\210\202\326 $\203\314 \334\313%G&%$\210\202\326 \333\313%G\331%$\210%*#\207\323\330\"\335!#\207" [value lengths max min colnames-p rownames-p mapcar length org-remove-if-not sequencep apply 0 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 fboundp set-text-properties remove-text-properties prin1-to-string row-names header file ob-R-transfer-variable-table-with-header name ob-R-transfer-variable-table-without-header restricted s org-rm-props] 9 (#$ . 6468)])
#@54 If there is not a current R process then create one.
(defalias 'org-babel-R-initiate-session #[(session params) "\306\230?\205t \206\f \307\310\301!\205 	\205 \311\312\n\"A?\313!\203( \202s \314 \315\216\316!\2036 q\210\317\320!\210\321 \210\322\f\206C !\323\324\"\203V \325!\210\202F )\326\327!\203d \330!\202o ;\203m \202o \330 !\210p**\207" [session ess-ask-for-ess-directory params #1=#:wconfig ess-local-process-name ess-current-process-name "none" "*R*" boundp assoc :dir org-babel-comint-buffer-livep current-window-configuration ((set-window-configuration #1#)) get-buffer require ess R get-process process-get callbacks ess-wait-for-process rename-buffer bufferp buffer-name R-proc] 4 (#$ . 7557)])
#@126 Associate R code buffer with an R session.
Make SESSION be the inferior ESS process associated with the
current code buffer.
(defalias 'org-babel-R-associate-session #[(session) "\302\303!!\304 \207" [session ess-local-process-name process-name get-buffer-process ess-make-buffer-current] 3 (#$ . 8294)])
#@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")) (#$ . 8608))
#@44 Construct the call to the graphics device.
(defalias 'org-babel-R-construct-graphics-device-call #[(out-file params) "\306\307\310	\"\205 \311\312	\"\313\314\nP!\236\206 \315\236\316\236A\317\211\fA@\320\f8\321\322\323#\324\325\n	\203I \326\202J \323\206P \323&.\207" [allowed-args out-file device org-babel-R-graphics-devices device-info params (:width :height :bg :units :pointsize :antialias :quality :compression :res :type :family :title :fonts :version :paper :encoding :pagecentre :colormodel :useDingbats :horizontal) string-match ".+\\.\\([^.]+\\)" match-string 1 intern ":" :png :R-dev-args nil 2 mapconcat #[(pair) "@	\235\203 \302\303\304@!\305\306OA#\207\307\207" [pair allowed-args format ",%s=%S" symbol-name 1 nil #1=""] 5] #1# format "%s(%s=\"%s\"%s%s%s); tryCatch({" "," extra-args filearg args] 9 (#$ . 9272)])
(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\")" (#$ . 10260))
#@26 Evaluate R code in BODY.
(defalias 'org-babel-R-evaluate #[(session body result-type result-params column-names-p row-names-p) "\203 \306	\n\f&\207\307	\n\f%\207" [session body result-type result-params column-names-p row-names-p org-babel-R-evaluate-session org-babel-R-evaluate-external-process] 7 (#$ . 11411)])
#@202 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.
(defalias 'org-babel-R-evaluate-external-process #[(body result-type result-params column-names-p row-names-p) "\306\307\"\203\256 \310\311!\312\n\313\f\203 \314\202 \315\203( \f\203$ \316\202) \314\202) \315\313\317'\"\320	\321\"%\"\210\322()\323)\235?\205\251 \324)\235\204\217 \325)\235\204\217 \326)\235\204\217 \327)\235\204\217 \330)\235\204\217 \331)\235\204\217 \332)\235\204\210 \333)\235\204\210 \334)\235\204\210 \335)\235\203\245 \336)\235\204\245 \337\340!*r*q\210\341\216\342	!\210\343 +\202\251 \344	\345\")\")\207\306\346\"\205\272 \312\n'\"\207" [result-type tmp-file org-babel-R-command org-babel-R-write-object-command row-names-p column-names-p eql value 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*" ((byte-code "\301!\203\n \302!\210\301\207" [#1=#:temp-buffer buffer-name kill-buffer] 2)) insert-file-contents buffer-string org-babel-import-elisp-from-file (16) output body result-params #2=#:--params #1#] 10 (#$ . 11741)])
#@191 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.
(defalias 'org-babel-R-evaluate-session #[(session body result-type result-params column-names-p row-names-p) "\306\307\"\203\321 \310\311!r	q\210\312\216\313\n!c\210\314\315!!\316\317\316!\210-\320\321!@\322@\323AB\2038 \324\2029 \325C\203K B\203G \326\202L \324\202L \325\327\330@\331\"%#\210\332DE\333E\235?\205\313 \334E\235\204\257 \335E\235\204\257 \336E\235\204\257 \337E\235\204\257 \340E\235\204\257 \341E\235\204\257 \342E\235\204\250 \343E\235\204\250 \344E\235\204\250 \345E\235\203\306 \346E\235\204\306 \310\311!FrFq\210\347\216\350@!\210\351 +\202\313 \352@\353\")C\")\207\306\354\"\205s\355\313\356\357\316\360\361\360\362\363!\204\354 \364\365\"\210\366 G\367\216rq\210\370H\371I\372JBJ\316\211KL\373\315p!!b\210`dM\211NM{KNM|\210*\355\313\nOD\374#c\210\375 \210Pb\210\212\376\377Q!\316\201S #\205I\376R\316\201S #)\204X\201T \315p!!\210\202/\373\315p!!b\210Kc\210\201U IR\".\"\"\"!\374#\207" [result-type #1=#:temp-buffer body session ess-eval-visibly-p ess-local-process-name eql value generate-new-buffer " *temp*" ((byte-code "\301!\203\n \302!\210\301\207" [#1# 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" ((byte-code "\301!\203\n \302!\210\301\207" [#2=#:temp-buffer buffer-name kill-buffer] 2)) insert-file-contents buffer-string org-babel-import-elisp-from-file (16) output mapconcat butlast delq mapcar #[(line) "G\301V\205 \207" [line 0] 2] #[(line) "\301\302\"\203 \303\225\304O\207\207" [line string-match "^\\([ ]*[>+\\.][ ]?\\)+\\([[0-9]+\\|[ ]\\)" 1 nil] 3] org-babel-comint-buffer-livep error "Buffer %s does not exist or has no process" match-data ((byte-code "\301\302\"\207" [save-match-data-internal set-match-data evaporate] 3)) #[(input) "\300\207" [nil] 1] "" #[(text) "	P\211\207" [string-buffer text] 2] process-mark "\n" inferior-ess-send-input re-search-forward regexp-quote tmp-file org-babel-R-write-object-command row-names-p column-names-p result-params #3=#:--params #2# save-match-data-internal comint-input-filter string-buffer comint-output-filter-functions dangling-text raw end start org-babel-R-eoe-indicator comint-last-input-end org-babel-R-eoe-output comint-prompt-regexp t accept-process-output split-string] 14 (#$ . 13164)])
#@100 R-specific processing of return value.
Insert hline if column names in output have been requested.
(defalias 'org-babel-R-process-value-result #[(result column-names-p) "\203\f 	@\302	ABB\207	\207" [column-names-p result hline] 3 (#$ . 15951)])
(provide 'ob-R)
