You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typesetting of R objects requires the R package Hmisc. Unfortunately, even after this is installed things are a bit weird. Calling latex the first time fails, but succeeds thereafter.
+--------------------------------------------------------------------+
| Sage Version 5.10, Release Date: 2013-06-17 |
| Type "notebook()" for the browser-based notebook interface. |
| Type "help()" for help. |
+--------------------------------------------------------------------+
sage: latex(r("1+2"))
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-1-0a8044ad4f2e> in <module>()
----> 1 latex(r("1+2"))
/Users/ivanandres/SageStuff/sage-5.10/local/lib/python2.7/site-packages/sage/misc/latex.pyc in __call__(self, x, combine_all)
934 """
935 if has_latex_attr(x):
--> 936 return LatexExpr(x._latex_())
937 try:
938 f = latex_table[type(x)]
/Users/ivanandres/SageStuff/sage-5.10/local/lib/python2.7/site-packages/sage/interfaces/r.pyc in _latex_(self)
1851 P.library('Hmisc')
1852 except ImportError:
-> 1853 raise RuntimeError, "The R package 'Hmisc' is required for R to LaTeX conversion, but it is not available."
1854 return LatexExpr(P.eval('latex(%s, file="");'%self.name()))
1855
RuntimeError: The R package 'Hmisc' is required for R to LaTeX conversion, but it is not available.
sage: latex(r("1+2"))
% latex.default(sage1, file = "")
%
\begin{table}[!tbp]
\begin{center}
\begin{tabular}{r}
\hline\hline
\multicolumn{1}{c}{}\tabularnewline
\hline
$3$\tabularnewline
\hline
\end{tabular}
\end{center}
\end{table}
This seems to be because of how the output from R is parsed. When Hmisc is first loaded it prints a "banner" which is misparsed as failing. After that, things work fine since no banner is printed. I don't know anything about R, but perhaps we could pass quietly=TRUE to require to avoid the banner?
sage: r.library('Hmisc')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-9e4e08408e41> in <module>()
----> 1 r.library('Hmisc')
/Users/ivanandres/SageStuff/sage-5.10/local/lib/python2.7/site-packages/sage/interfaces/r.pyc in library(self, library_name)
592 # try hard to parse the message string in a locale-independent way
593 if ' library(' in ret: # locale-independent key-word
--> 594 raise ImportError, "%s"%ret
595 else:
596 try:
ImportError: Loading required package: Hmisc
Loading required package: survival
Loading required package: splines
Loading required package: Formula
Hmisc library by Frank E Harrell Jr
Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview')
to see overall documentation.
Attaching package: ‘Hmisc’
The following object(s) are masked from ‘package:survival’:
untangle.specials
The following object(s) are masked from ‘package:base’:
format.pval, round.POSIXt, trunc.POSIXt, units
Typesetting of R objects requires the R package
Hmisc
. Unfortunately, even after this is installed things are a bit weird. Callinglatex
the first time fails, but succeeds thereafter.This seems to be because of how the output from R is parsed. When
Hmisc
is first loaded it prints a "banner" which is misparsed as failing. After that, things work fine since no banner is printed. I don't know anything about R, but perhaps we could passquietly=TRUE
torequire
to avoid the banner?Component: interfaces
Keywords: R, latex
Issue created by migration from https://trac.sagemath.org/ticket/15068
The text was updated successfully, but these errors were encountered: