Daniel Drake<address@hidden> writes:
Hi All,
I'm using R in org-mode/babel to analyze data from a psychological
study. The subjects in this study are identified by nine digit integers
(e.g., 987654321) that I treat as strings (or factors) in my R data
frames.
Tables output by an R code block that contain these subject IDs are
not formatted properly: the subject IDs seem to be treated as numbers
and a decimal point and a trailing zero are appended. For example,
what should be
| subj.id |
|-----------|
| 987654321 |
becomes
| subj.id |
| 987654321.0 |
(I've included real, self-contained code below.)
When I write the data frames directly to a file from within the R code
block (using a write.table function call that mimics the one in
ob-R.el), the integer IDs are preserved; but when code from ob-R.el
writes them out, the values get reformated as floats.
I've noticed that eight digit integers are not modified in the same
way, which makes me wonder if there is a 'digits' threshold I could
modify to prevent this from happening.
I've pretty much ruled out the possibility that this transformation
occurs in R; however I'm not proficient enough in elisp to follow the
operations that happen after the data frame is written to a file in
the org-babel-R-write-object-command.
Any pointers to help me figure this out would be very appreciated!
(I've seen this thread:
http://comments.gmane.org/gmane.emacs.orgmode/31373, but do not know
if the conversion to calc has been made already or if it is the source
of the problem.)
Hi Dan,
When I launch Emacs without any personal configuration (emacs -Q),
evaluate ob-R.el to add R support, and then execute your code blocks I
get the following behavior.
I would recommend installing the latest version of Org-mode from source
as that tends to fix many problems, and will at least ensure that we are
both working from the same code base moving forward. See
http://orgmode.org/worg/org-faq.html#Keeping-current
Best,