[R] Hmisc latex function

Paul Johnson pauljohn at ku.edu
Thu Dec 15 22:53:42 CET 2005


Does anybody suggest a work-around this problem?

pj

Marc Schwartz (via MN) wrote:
> On Wed, 2005-10-12 at 08:33 -0500, Charles Dupont wrote:
> 
>>Marc Schwartz (via MN) wrote:
>>
>>>On Tue, 2005-10-11 at 10:01 -0400, Rick Bilonick wrote:
>>>
>>>
>>>>I'm using R 2.2.0 on an up-to-date version of Fedora Core 4 with the
>>>>latest version of Hmisc. When I run an example from the latex function I
>>>>get the following:
>>>>
>>>>
>>>>
>>>>>x <- matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','enLine
>>>>
>>>>2')))
>>>>
>>>>
>>>>>x
>>>>
>>>> c d enLine 2
>>>>a 1 3        5
>>>>b 2 4        6
>>>>
>>>>
>>>>>latex(x)   # creates x.tex in working directory
>>>>
>>>>sh: line 0: cd: â€œ/tmp/Rtmpl10983â€: No such file or directory
>>>>This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
>>>>entering extended mode
>>>>! I can't find file `â€œ/tmp/Rtmpl10983/file643c9869â€'.
>>>><*> â€œ/tmp/Rtmpl10983/file643c9869â€
>>>>
>>>>Please type another input file name: q
>>>>(/usr/share/texmf/tex/latex/tools/q.tex
>>>>LaTeX2e <2003/12/01>
>>>>Babel <v3.8d> and hyphenation patterns for american, french, german,
>>>>ngerman, b
>>>>ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch,
>>>>esperanto, e
>>>>stonian, finnish, greek, icelandic, irish, italian, latin, magyar,
>>>>norsk, polis
>>>>h, portuges, romanian, russian, serbian, slovak, slovene, spanish,
>>>>swedish, tur
>>>>kish, ukrainian, nohyphenation, loaded.
>>>>File ignored
>>>>xdvi-motif.bin: Fatal error: /tmp/Rtmpl10983/file643c9869.dvi: No such
>>>>file.
>>>>
>>>>
>>>>How can I fix this?
>>>>
>>>>Rick B.
>>>
>>>
>>>I get the same results, also on FC4 with R 2.2.0.
>>>
>>>I am cc:ing Frank here for his input, but a quick review of the code and
>>>created files suggests that there may be conflict between the locations
>>>of some of the resultant files during the latex system call. Some files
>>>appear in a temporary R directory, while others appear in the current R
>>>working directory.
>>>
>>>For example, if I enter the full filename:
>>> 
>>>  /tmp/RtmpC12100/file643c9869.tex
>>>
>>>at the latex prompt, I get:
>>>
>>>
>>>
>>>>latex(x)
>>>
>>>sh: line 0: cd: â€œ/tmp/RtmpC12100â€: No such file or directory
>>>This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
>>>entering extended mode
>>>! I can't find file `â€œ/tmp/RtmpC12100/file643c9869â€'.
>>><*> â€œ/tmp/RtmpC12100/file643c9869â€
>>>
>>>Please type another input file name: *** loading the extensions
>>>datasource
>>>/tmp/RtmpC12100/file643c9869.tex
>>>(/tmp/RtmpC12100/file643c9869.tex
>>>LaTeX2e <2003/12/01>
>>>Babel <v3.8d> and hyphenation patterns for american, french, german,
>>>ngerman, b
>>>ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch,
>>>esperanto, e
>>>stonian, finnish, greek, icelandic, irish, italian, latin, magyar,
>>>norsk, polis
>>>h, portuges, romanian, russian, serbian, slovak, slovene, spanish,
>>>swedish, tur
>>>kish, ukrainian, nohyphenation, loaded.
>>>(/usr/share/texmf/tex/latex/base/report.cls
>>>Document Class: report 2004/02/16 v1.4f Standard LaTeX document class
>>>(/usr/share/texmf/tex/latex/base/size10.clo))
>>>(/usr/share/texmf/tex/latex/geometry/geometry.sty
>>>(/usr/share/texmf/tex/latex/graphics/keyval.sty)
>>>(/usr/share/texmf/tex/latex/geometry/geometry.cfg))
>>>No file file643c9869.aux.
>>>[1] (./file643c9869.aux) )
>>>Output written on file643c9869.dvi (1 page, 368 bytes).
>>>Transcript written on file643c9869.log.
>>>xdvi-motif.bin: Fatal error: /tmp/RtmpC12100/file643c9869.dvi
>>
>>
>>Hmmmm,  It works for me.  Interesting.
>>
>>It almost looks like the temp dir is not being created, but thats not 
>>possible because R does that.  It might be a Unicode issue with you 
>>system shell.  Can you run this statement in R
>>
>>sys(paste('cd',dQuote(tempdir()),";",
>>"echo Hello BOB > test.test",
>>";","cat test.test"))
>>
>>
>>What version of Hmisc are you using?  What local are you using?
>>
>>Charles
> 
> 
> Hmisc version 3.0-7, Dated 2005-09-15, which is the latest according to
> CRAN.
> 
> 
>>sys(paste('cd',dQuote(tempdir()),";",
> 
> + "echo Hello BOB > test.test",
> + ";","cat test.test"))
> sh: line 0: cd: â€œ/tmp/RtmpGY5553â€: No such file or directory
> [1] "Hello BOB"
> 
> 
>>From a bash console:
> 
> $ cd /tmp/RtmpGY5553
> $ pwd
> /tmp/RtmpGY5553
> 
> 
> $ locale
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=
> 
> 
> On the creation of the sys() call, it looks like the backquotes are
> causing the problem:
> 
> 
>>paste('cd',dQuote(tempdir()))
> 
> [1] "cd â€œ/tmp/RtmpGY5553â€"
> 
> 
>>From a bash shell:
> 
> $ cd â€œ/tmp/RtmpGY5553â€
> bash: cd: â€œ/tmp/RtmpGY5553â€: No such file or directory
> $ cd "/tmp/RtmpGY5553"
> $ pwd
> /tmp/RtmpGY5553
> 
> 
> According to ?dQuote:
> 
> By default, sQuote and dQuote provide undirectional ASCII quotation
> style. In a UTF-8 locale (see l10n_info), the Unicode directional quotes
> are used.
> 
> The See Also points to "shQuote for quoting OS commands."
> 
> 
> HTH,
> 
> Marc
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Paul E. Johnson                       email: pauljohn at ku.edu
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700




More information about the R-help mailing list