I have just installed ess-view, following the steps outlined in the installation section here. Let's say I have the following dataframe:

x <- sample(1:10, size = 100, replace = TRUE)
y <- sample(2:11, size = 100, replace = TRUE)
hoo <- data.frame(x, y)

After running these commands in R, C-x w allows me to choose the dataframe, but then produces the following error:

"R error during background ESS command 'exists(hoo)' Error: invalid first argument"

Using the View function or other means, this dataframe can be displayed without any issues. Any ideas why this might not be working?

  • ess doesn't this package suffice? Is there a reason, you are using ess-view? The aforementioned github repo doesn't even seem to have good number of stars
    – Saravana
    Commented Mar 30 at 1:10
  • Thank you for your response. I am new to the ESS package and am exploring the associated functionality. The in-built View() command only seems to allow simple navigation, using the cursor or page-up/-down buttons, but does not seem responsive to M-<, M->, M-r or the trackpad, for example. Searching the manual for View() also did not yield anything in that respect, but perhaps there is something I have missed? So, View() is nice in principle, I am just looking for a bit more navigation functionality when exploring the data.
    – Tiberius
    Commented Mar 31 at 7:21

1 Answer 1


The code of ess-view smells ...

Any idea what ess-view-data does?

This works ...

(require 'ess-view)

(defun ess-view-boolean-command (s cmd &optional on)
   (pcase on
      (format "%s(\"%s\")\n" cmd s))
      (format "%s(%s)\n" cmd s)))))

(defun ess-view-boundp (s)
  (not (not (ess-view-boolean-command s "exists" 'name))))

(defun ess-view-data-type-is (s type)
  (when (ess-view-boolean-command s (format "is.%s" type))

(defun ess-view-which-type (s types)
  (unless (ess-view-boundp s)
    (error "`%s' is not bound" s))
  (->> types
        (lambda (it)
          (ess-view-data-type-is s it)))))

(defun ess-view-inspect-df-inner (row-names save)
  "Show a dataframe.
If ROW-NAMES is t, the row names of the dataframe are also exported.
If SAVE is t, it also saves back the result."
  (or (when ess-view--spreadsheet-program
        (setq ess-view-oggetto (ess-read-object-name "name of R object:"))
        (setq ess-view-oggetto (substring-no-properties (car ess-view-oggetto)))
        (or (unless (ess-view-boundp ess-view-oggetto)
              (message "The object does not exists"))
            (pcase (ess-view-which-type ess-view-oggetto '(vector data.frame matrix))
               (ess-view-print-vector ess-view-oggetto))
               (ess-view-data-frame-view ess-view-oggetto save row-names t))
               (ess-view-data-frame-view ess-view-oggetto save nil nil))
               (message "the object is neither a vector or a data.frame; don't know how to show it...")))))

(defun ess-view-create-env ()
  "Create a temporary R environment.
This is done in order not to pollute user's environments with a temporary
copy of the passed object which is used to create the temporary .csv file."
  (let ((nome-env (ess-view-random-string)))
    ;; it is very unlikely that the user has an environment which
    ;; has the same name of our random generated 20-char string,
    ;; but just to be sure, we run this cycle recursively
    ;; until we find an environment name which does not exist yet
    (if  (and (ess-view-boundp nome-env)
              (ess-view-data-type-is nome-env 'environment))
  • Thank you so much! Yes, ess-view-data I am also looking into. As per my comment to Saravana, I am still exploring the functionality of the different viewing facilities for ESS and just noticed that ess-viewwasn't working.
    – Tiberius
    Commented Mar 31 at 7:34
  • In ess-view, the exists function, should pass in a string and not a symbol ... (This is what meant by Error: invalid first argument") Similarly, in the environment case, var should be checked if it exists before its value is sought ... That is what my two function does ...
    – mxnt
    Commented Mar 31 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.