Ess-command

Eric.Belpaire at equant.com Eric.Belpaire at equant.com
Thu Sep 12 10:04:38 CEST 2002


Hello,

First of all, many thanks to all contributors for ESS.  It's great code.

rossini> It's simple in Windows, with R :-).
That's what I understood from reading the ESS manual too, but I didn't get
to implement it right.
rossini> What is the error?  That will let us know what went wrong.
Thanks for your offer to help.

I again checked that I set the right settings in ess-site.el; I have Ess
5.1.24 with Emacs 21.1 on Windows 95.
It seems as if emacs selects ess-language=sas and ess-dialect=sas, although
I've set this to ess-language=S and ess-dialect=R in my _emacs
initialisation file.  I've customised it with the Local / Ess group.
I've provided below my emacs lisp code, the backtrace and the *ESS* buffer
content.
What's the proper sequence of ess function calls?
Where should I set which variables (if it's not in _emacs)?

Thanks in advance for your help.
Eric

My emacs lisp code is:
(defun cum-ndist (x)
  "Compute the normal distribution function value with the R package."
  (let ((cmdline (concat "pnorm (" (number-to-string x) ")")))
    (inferior-ess)
    (ess-request-a-process "Message") ;; this line may be unneeded
    (ess-command cmdline)
    (ess-quit))) ;; this line may be unneeded
(cum-ndist 1.2048)
; End of emacs lisp code

The *Backtrace* reads:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("[^      \n]+" nil 0)
  ess-line-to-list-of-words(nil)
  inferior-ess-make-comint("*SAS*" "SAS" nil)
  ess-multi("SAS" #<buffer *SAS*> nil)
  inferior-ess()
  (let ((cmdline ...)) (inferior-ess) (ess-request-a-process "Message")
(ess-command cmdline) (ess-quit))
  cum-ndist(1.2048)
  eval((cum-ndist 1.2048))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
* call-interactively(eval-last-sexp)
End of *Backtrace*


The *ESS* buffer contains:
(ess-setq-vars-LOCAL): language=SAS, dialect=SAS, buf=unlikely-name.sas,
comint..echoes=nil, comint..sender=comint-simple-send
(ess-mode-1): ess-language=SAS, ess-dialect=SAS buf=unlikely-name.sas
(ess-mode-1.5): alist=((ess-local-customize-alist quote
SAS-customize-alist) (ess-language . SAS) (ess-dialect . SAS)
(ess-mode-editing-alist . SAS-editing-alist) (ess-mode-syntax-table .
SAS-syntax-table) (inferior-ess-program . inferior-SAS-program-name)
(ess-help-sec-regex . ^[A-Z. ---]+:$) (ess-help-sec-keys-alist .  )
(ess-object-name-db-file . ess-sas-nd . help("%s",pager="cat",window=F)
) (inferior-ess-exit-command . endsas;
) (ess-loop-timeout . 500000) (inferior-ess-primary-prompt . ^)
(inferior-ess-secondary-prompt . ^)
(comint-use-prompt-regexp-instead-of-fields . t) (inferior-ess-start-file)
(inferior-ess-start-args . inferior-SAS-args-temp)
(ess-local-process-name))
(ess-mode-1.6): editing-alist=((sentence-end . ;[
 */]*) (paragraph-start . ^[  ]*$) (paragraph-separate . ^[       ]*$)
(paragraph-ignore-fill-prefix . t) (adaptive-fill-mode)
(indent-line-function quote sas-indent-line) (require-final-newline . t)
(comment-start . \*\|/\*) (comment-start-skip . \*+) (comment-end . ;\|\*/)
(comment-column . 40) (parse-sexp-ignore-comments . t) (ess-set-style .
ess-default-style) (ess-local-process-name) (tab-stop-list .
ess-sas-tab-stop-alist) (ess-mode-syntax-table . SAS-syntax-table)
(font-lock-keywords-case-fold-search . t) (font-lock-defaults quote
(SAS-mode-font-lock-keywords)))
(ess-setq-vars-LOCAL): language=SAS, dialect=SAS, buf=unlikely-name.sas,
comint..echoes=nil, comint..sender=comint-simple-send

Finished setting up ESS-mode.
[ess-site.el]: ess-customize-alist=((ess-local-customize-alist quote
SAS-customize-alist) (ess-language . SAS) (ess-dialect . SAS)
(ess-mode-editing-alist . SAS-editing-alist) (ess-mode-syntax-table .
SAS-syntax-table) (inferior-ess-program . inferior-SAS-program-name)
(ess-help-sec-regex . ^[A-Z. ---]+:$) (ess-help-sec-keys-alist .  )
(ess-object-name-db-file . ess-sas-namedb.el) (inferior-ess-objects-command
. objects(%d)) (inferior-ess-help-command . help("%s",pager="cat",window=F)
) (inferior-ess-exit-command . endsas;
) (ess-loop-timeout . 500000) (inferior-ess-primary-prompt . ^)
(inferior-ess-secondary-prompt . ^)
(comint-use-prompt-regexp-instead-of-fields . t) (inferior-ess-start-file)
(inferior-ess-start-args . inferior-SAS-args-temp)
(ess-local-process-name))
[ess-site.el _2_]: ess-customize-alist=((ess-local-customize-alist quote
SAS-customize-alist) (ess-language . SAS) (ess-dialect . SAS)
(ess-mode-editing-alist . SAS-editing-alist) (ess-mode-syntax-table .
SAS-syntax-table) (inferior-ess-program . inferior-SAS-program-name)
(ess-help-sec-regex . ^[A-Z. ---]+:$) (ess-help-sec-keys-alist .  )
(ess-object-name-db-file . ess-sas-namedb.el) (inferior-ess-objects-command
. objects(%d)) (inferior-ess-help-command . help("%s",pager="cat",window=F)
) (inferior-ess-exit-command . endsas;
) (ess-loop-timeout . 500000) (inferior-ess-primary-prompt . ^)
(inferior-ess-secondary-prompt . ^)
(comint-use-prompt-regexp-instead-of-fields . t) (inferior-ess-start-file)
(inferior-ess-start-args . inferior-SAS-args-temp)
(ess-local-process-name))
END of *ESS* buffer.


rossini at blindglobe.net (A.J. Rossini) on 6 September 2002 22'12'11 writes:

What is the error?  That will let us know what went wrong.

>>>>> "eric" == Eric Belpaire <Eric.Belpaire at equant.com> writes:

    eric> Hello,
    eric> I would like to evaluate the cumulative normal function
    distribution value
    eric> of 1.2048 from within emacs lisp.
    eric> As there is no such function in emacs lisp, to the best of my
    knowledge, I
    eric> want to compute "pnorm (1.2048)"
    eric> via an inferior ESS process by means of ess-command.
    eric> I have Ess 5.1.24 with Emacs 21.1 on Windows 95.
    eric> (ess-command "pnorm \(1.204859\)") gives an error message.

    eric> Is this feasible?
    eric> If so, can someone indicate where I can find how to set this up
    properly?
    eric> (i.e. the right sequence of function call to get the answer in
    emacs lisp?)
    eric> If not, I would appreciate any other approach to do this
    evaluation.

    eric> Thanks in advance.





Eric BELPAIRE
Norma, 5th Floor, Office 9
18, rue Paul Lafargue - 92904 Paris La Defense 10 Cedex
Tel. +33 146 41 12 94 / CVS: 220 1294 / Mobile: none
mailto: Eric.Belpaire at equant.com

"C'est à nous de tenir le cap à la recherche de pratiques et d'idées
nouvelles qui nous permettront de créer des vies et des organisations
dignes d'être vécues et habitées par l'homme."
"It is up to us to journey forth in search of new practices and new ideas
that will enable us to create lives and organizations worthy of human
habitation."            Margaret Wheatley

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the ESS-help mailing list