summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Juste <jeremiejuste@gmail.com>2021-05-03 00:23:36 +0200
committerJeremie Juste <jeremiejuste@gmail.com>2021-05-03 00:29:09 +0200
commit9014577df289322e4eb294ebcf7c7fbfb9d1a414 (patch)
treebf8dccd9fb711cf80f4d671eb8f4a48dd28f381b
parentc0338142b77f5be5bd0512793341f668fb39289a (diff)
downloadorg-mode-9014577df289322e4eb294ebcf7c7fbfb9d1a414.tar.gz
test-ob-R.el: add tests for how NA values are printed
* testing/lisp/test-ob-R.el (ert-deftest test-ob-r/NA-blank): new test for :results value. Make sure that NA values in R data.frames are empty string instead of nil previously see https://orgmode.org/list/87pn1dufm2.fsf@gmail.com/
-rw-r--r--testing/lisp/test-ob-R.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el
index 12eac83..c36bac9 100644
--- a/testing/lisp/test-ob-R.el
+++ b/testing/lisp/test-ob-R.el
@@ -142,6 +142,15 @@ log10(10)
#+end_src"
(should (string= "[1] 14\n[1] 2.302585\n[1] 1\n[1] 20\n[1] 0.3333333\n[1] Inf\n" (org-babel-execute-src-block))))))
+(ert-deftest test-ob-r/NA-blank ()
+ "For :results value, NAs should be empty"
+ (let (ess-ask-for-ess-directory ess-history-file)
+ (should (equal '(("A" "B") hline ("" 1) (1 2) (1 "") (1 4) (1 4))
+ (org-test-with-temp-text "#+BEGIN_SRC R :results value :colnames yes
+ data.frame(A=c(NA,1,1,1,1),B=c(1,2,NA,4,4))
+#+end_src"
+ (org-babel-execute-src-block))))))
+
(provide 'test-ob-R)
;;; test-ob-R.el ends here