0

I want a table in org mode to meet two needs:

  1. When it is exported as latex, the result table in latex has the top horizontal line. like this: enter image description here
  2. Can be used as input variable for R code blocks

But it seems that if a table's first line is hline, then it cannot be used as input variable for R code blocks. For example:

#+name: rrm_base_set
|-----+------------+---------------+---------------+----------------+---------------|
| set | fast write | total refresh | evict refresh | global refresh | decay refresh |
|-----+------------+---------------+---------------+----------------+---------------|
|   1 |   38802959 |       9402302 |       9369531 |          32771 |             0 |
|   2 |   39054186 |       8703155 |       8633222 |          69933 |             0 |
|   4 |   39063762 |       8677476 |       8533626 |         143850 |             0 |
|   8 |   39097327 |       8493754 |       8202282 |         291472 |             0 |
|  16 |   39193948 |       7856326 |       7269786 |         586540 |             0 |
|  32 |   39574909 |       4866546 |       3689315 |        1177231 |             0 |
|  64 |   39672538 |       4957701 |       2600099 |        2357602 |             0 |
| 128 |   39672538 |       6641223 |       2206883 |        4434340 |             0 |
| 256 |   39672538 |       8861756 |       1123530 |        7428850 |        309376 |
|-----+------------+---------------+---------------+----------------+---------------|

#+begin_src R :var rrm_base_set=rrm_base_set :colnames t :exports none :cache no
rrm_base_set$set=factor(rrm_base_set$set,ordered=TRUE)
rrm_base_set_ratio=rrm_base_set%>%mutate(fast_write_ratio=`fast.write`/40000000, refresh_write_ratio=`total.refresh`/40000000)
#+end_src

The error message is:

Wrong type argument: sequencep, hline

If I remove the first line which is hline, then the R source block can be executed correctly.

Is there a way to make R source block accept a table with first line to be hline as input variable? If there is no way, is there a way to export a table whose first line is not hline to latex table with top hline?

3
  • Please set debug-on-error to t and post the backtrace in your question. Start Emacs using emacs -Q (no init file), to be sure you're not introducing a problem from your init file.
    – Drew
    Jun 1 at 14:35
  • The question is unclear: what were you doing at the time that you got the error? Were you exporting? If so, I cannot reproduce (although I had to give the table a name in order to satisfy the reference). Were you evaluating the R block? If so, I get errors that I cannot debug, since I know virtually nothing about R. A clear recipe would go a long way towards resolving the problem.
    – NickD
    Jun 1 at 19:46
  • A "clear recipe" would include a complete but minimal test file (what you show above may be minimal but is not complete) and a complete list of R libraries that you use, so somebody else has a change to replicate the problems.
    – NickD
    Jun 1 at 19:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.