From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id oOMcLemwBGD1YAAA0tVLHw (envelope-from ) for ; Sun, 17 Jan 2021 21:49:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yCfxKOmwBGAjSgAAbx9fmQ (envelope-from ) for ; Sun, 17 Jan 2021 21:49:29 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E99D29402C8 for ; Sun, 17 Jan 2021 21:49:28 +0000 (UTC) Received: from localhost ([::1]:59900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1FvK-0002NH-DF for larch@yhetil.org; Sun, 17 Jan 2021 16:49:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1FuO-0002Ld-Mf for emacs-orgmode@gnu.org; Sun, 17 Jan 2021 16:48:28 -0500 Received: from mx0a-000b4001.pphosted.com ([148.163.146.25]:54306) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1FuM-0003aL-Vb for emacs-orgmode@gnu.org; Sun, 17 Jan 2021 16:48:28 -0500 Received: from pps.filterd (m0166812.ppops.net [127.0.0.1]) by mx0a-000b4001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 10HLTNdJ007003; Sun, 17 Jan 2021 21:48:24 GMT Received: from az1-msa-prod02.server.ufl.edu (az1-msa-prod02.server.ufl.edu [128.227.74.23]) by mx0a-000b4001.pphosted.com with ESMTP id 363s2r6g7e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 17 Jan 2021 21:48:24 +0000 Received: from ls-presnell (ip24-170-195-154.ga.at.cox.net [24.170.195.154]) (Authenticated sender: presnell) by az1-msa-prod02.server.ufl.edu (Postfix) with ESMTPSA id 7F36640053; Sun, 17 Jan 2021 16:48:23 -0500 (EST) References: <87h7njdr0x.fsf@ufl.edu> <97F6B6F8-E109-4089-8C21-03E087AA4AD3@health.ucsd.edu> <87im7xuhrh.fsf@gmail.com> User-agent: mu4e 1.4.13; emacs 28.0.50 From: Brett Presnell To: Jeremie Juste Subject: Re: na=\"nil\" in ob-R.elo In-reply-to: <87im7xuhrh.fsf@gmail.com> Date: Sun, 17 Jan 2021 16:48:23 -0500 Message-ID: <87y2grck0o.fsf@ufl.edu> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-17_13:2021-01-15, 2021-01-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxlogscore=756 priorityscore=1501 suspectscore=0 bulkscore=0 clxscore=1034 mlxscore=0 spamscore=0 impostorscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101170136 Received-SPF: pass client-ip=148.163.146.25; envelope-from=presnell@member.fsf.org; helo=mx0a-000b4001.pphosted.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brett Presnell , "Berry, Charles" , "Berry, Charles via General discussions about Org-mode." Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.26 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=member.fsf.org (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: E99D29402C8 X-Spam-Score: -2.26 X-Migadu-Scanner: scn1.migadu.com X-TUID: MMkHbSUWdJtk I can verify that the :post work-around suggested by Chuck and implemented by Jeremie works as advertised. FWIW, I would certainly prefer to see the implementation org-babel-R-write-object-command changed so that the work-around wouldn't be necessary. Thank you to both Chuck and Jeremie for looking into this. Jeremie Juste writes: > [External Email] > > Hello, > > Thanks for the feedback > > || On Saturday, 16 Jan 2021 at 00:19, Berry, Charles" via "General discussions about Org-mode. wrote: >> You can use a :post header to customize outputs like this to make them >> more pleasing. Or just use your own >> `org-babel-R-write-object-command'. > > > As a quick work around you can use > > #+name: remove-nil > #+begin_src emacs-lisp :var tbl="" > (mapcar (lambda (row) > (mapcar (lambda (cell) > (if (equal "nil" cell) > "" > cell)) > row)) > tbl) > > #+end_src > > > > #+BEGIN_SRC R :results value :colnames yes :post remove-nil[:colnames yes](*this*) > data.frame(A=c(NA,1,1,1,1),B=c(1,2,NA,4,4)) > #+end_src > > #+RESULTS: > | A | B | > |---+---| > | | 1 | > | 1 | 2 | > | 1 | | > | 1 | 4 | > | 1 | 4 | > > > >>> Probably a silly question, but in ob-R.el, what is the reason for >>> setting na=\"nil\" when defining org-babel-R-write-object-command? Is >>> this an elisp compatibility thing? >>> >> >> I don't get it either. The value corresponding to the NA becomes a string in emacs-lisp whether \"nil\" or \"\" is used. >> So when passed to elisp via a :post header referencing an emacs-lisp >> src block, its treated as a string. > > Thanks Chuck for pointing this out. R users are used to handle NA but in > this particular case where empty string and NA are treated > the same, I'm not sure the nil feature is very useful. If it does not break > anything else I will consider removing it. > > > Best regards,