Re: [R] Hmisc latex function

2005-12-16 Thread Marc Schwartz
Paul,

I believe that the bug has been fixed in the CVS version of latex(), but
it has not yet made its way to an updated version of Hmisc on CRAN from
what I can see.

You can get the updated version of latex() from:

http://biostat.mc.vanderbilt.edu/cgi-bin/cvsweb.cgi/Hmisc/R/latex.s

Click on the 'download' link for version 1.14 at the top of the page.
You can save the updated code to a text file and then source() it into a
R session for the time being.

HTH,

Marc Schwartz

On Thu, 2005-12-15 at 15:53 -0600, Paul Johnson wrote:
 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 35
 b 2 46
 
 
 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
 
 
 H,  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:
  
  
 

Re: [R] Hmisc latex function

2005-12-15 Thread Paul Johnson
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 35
b 2 46


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


H,  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@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

Re: [R] Hmisc latex function

2005-10-16 Thread Peter Dalgaard
Charles Dupont [EMAIL PROTECTED] writes:

 For a temporary fix source the attached file after loading the Hmisc
 library.  I will fix this in source for the next version.

Or, slightly shorter but somewhat dirtier:

 evalq(dQuote - shQuote, environment(latex))


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@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


Re: [R] Hmisc latex function

2005-10-12 Thread Charles Dupont
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 35
b 2 46

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


H,  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

-- 
Charles Dupont  Computer System Analyst School of Medicine
Department of Biostatistics Vanderbilt University

__
R-help@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

Re: [R] Hmisc latex function

2005-10-12 Thread Rick Bilonick
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 35
 b 2 46

 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



 H,  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

I'm using Hmisc 3.0-7 (2005-09-15). I did an update.packages right after 
installing R 2.2.0. Here is the output I get:

sh: line 0: c: /tmp/RtmpSp4207: No such file or directory
[1] Hello BOB

Thanks.

Rick B.

__
R-help@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

Re: [R] Hmisc latex function

2005-10-12 Thread Peter Dalgaard
Charles Dupont [EMAIL PROTECTED] writes:

 H,  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

It's a Unicode issue alright. dQuote is intended for textual output,
and in UTF-8 locales it will use Unicode codepoints 0x201c and 0x201d,
which the shell is not expected to make head or tails of.

The help page would have told you, and pointed you to shQuote() as
well...
 
 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
 
 -- 
 Charles DupontComputer System Analyst School of Medicine
   Department of Biostatistics Vanderbilt University
 
 __
 R-help@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

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@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


Re: [R] Hmisc latex function

2005-10-12 Thread David Whiting
Charles Dupont wrote:
[...]

 
 
 H,  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
 

I've had similar problems latex() which I tracked down to dQuote() that
I think are related to unicode and locales on Ubuntu 5.04. I think the
problem is with Ubuntu (because I get funny little boxes now and then
with various applications), but have not managed to get my head around
unicode sufficiently well to be able to write a sensible post about this
or work out how to fix it. My current way of getting around this in R is
to change the locale:

 Sys.getlocale()
[1]
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
 tempdir()
[1] /tmp/RtmpWL64Z2
 dQuote(tempdir())
[1] “/tmp/RtmpWL64Z2”  [I get funny little boxes here]
 Sys.setlocale(LC_CTYPE, C)
[1] C
 Sys.getlocale()
[1]
LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
 dQuote(tempdir())
[1] \/tmp/RtmpWL64Z2\ [No funny boxes this time]

 version
 _
platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major2
minor1.1
year 2005
month06
day  20
language R


[Hmmm, I need to update my R installation]

-- 
David Whiting
School of Clinical Medical Sciences, The Medical School
University of Newcastle upon Tyne, NE2 4HH, UK.

__
R-help@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

Re: [R] Hmisc latex function

2005-10-12 Thread Marc Schwartz (via MN)
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 35
 b 2 46
 
 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
 
 
 H,  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@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

Re: [R] Hmisc latex function

2005-10-12 Thread Charles Dupont

Peter Dalgaard wrote:

Charles Dupont [EMAIL PROTECTED] writes:



H,  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



It's a Unicode issue alright. dQuote is intended for textual output,
and in UTF-8 locales it will use Unicode codepoints 0x201c and 0x201d,
which the shell is not expected to make head or tails of.

The help page would have told you, and pointed you to shQuote() as
well...
 




Well There be the problem.

First I have heard about shQuote.  When I last looked at the help file 
it didn't have the shQuote entry.


For a temporary fix source the attached file after loading the Hmisc 
library.  I will fix this in source for the next version.



--
Charles Dupont  Computer System Analyst School of Medicine
Department of Biostatistics Vanderbilt University
##!!WRONG ARG x in !.SV4. def latex generic!
##Changed x to object inside latex() for !.SV4. (Thanks David Lovell)

##Thanks to David R. Lovell [EMAIL PROTECTED] CSIRO
##for scientific=8Feb2000

first.word - function(x, i=1, expr=substitute(x))
{
  words -
if(!missing(x))
  as.character(x)[1]
else
  as.character(unlist(expr))[1]
  
  ## Added !missing(x) as.char(x) 25May01
  ##first.letters - substring(words, 1, 1)
  ##word.selector - (match(first.letters, c(letters,LETTERS,.), 0)  0)
  ##words - words[word.selector][i]
  ##if(!under.unix) {
  ##  words - sedit(words,'.','')
  ##  words - substring(words,1,8)
  ##}
  ## 8Nov00 FEH:
  
  if(i  1)
stop('i  1 not implemented')
  
  chars - substring(words, 1:nchar(words), 1:nchar(words))
  legal.chars - c(letters,LETTERS,'.',
   '0','1','2','3','4','5','6','7','8','9')
  non.legal.chars - (1:length(chars))[chars %nin% legal.chars]
  if(!any(non.legal.chars))
return(words)
  
  if(non.legal.chars[1]==1)
return(character(0))
  
  substring(words, 1, non.legal.chars[1]-1)
}


##1. if x is a data.frame, then do each component separately.
##2. if x is a matrix, but not a data.frame, make it a data.frame
##   with individual components for the columns.
##3. if a component x$x is a matrix, then do all columns the same.
##4. Use right justify by default for numeric columns.
##5. Use left justify for non-numeric columns.

## The following are made complicated by matrix components of data.frames:
##6. vector cdec must have number of items equal to number of columns
##   of input x.
##7. matrix dec must have number of columns equal to number of columns
##   of input x.
##8. scalar dec is expanded to a vector cdec with number of items equal
##   to number of columns of input x.
##9. vector rdec must have number of items equal to number of rows of input x.
##   rdec is expanded to matrix dec.
##10. col.just must have number of columns equal to number of columns
##of output cx.

## Value:
## character matrix with character images of properly rounded x.
## matrix components of input x are now just sets of columns of character 
matrix.
## attr(,col.just) repeats input col.just when provided.
##  Otherwise, recommended justification for columns of output.
##  Default is l for characters and factors, r for numeric.
##  When dcolumn==T, numerics will have ..


## FEH 21May96 - changed default for numeric.dollar to cdot
## FEH  5Jun96 - re-written to not rely on as.data.frame,
##   converted data frames to matrices the slow way
##   added matrix.sep 
## 12Aug99 - allowed # decimal places=NA (no rounding, just use format())
##27May02 - added booktabs FEH
## 13Dec02 - added ctable   FEH
## arguments included check.names=TRUE 23jan03

format.df - function(x,
  digits, dec=NULL, rdec=NULL, cdec=NULL,
  numeric.dollar=cdot, na.blank=FALSE,
  na.dot=FALSE, blank.dot=FALSE, col.just=NULL,
  cdot=FALSE, dcolumn=FALSE, matrix.sep=' ', 
scientific=c(-4,4), ...)
{
  if(cdot  dcolumn)
stop('cannot have both cdot=T and dcolumn=T')
  
  if(missing(digits))
digits - NULL
  
  if((!length(digits))+(!length(dec))+(!length(rdec))+(!length(cdec))  3)
stop('only one of digits, dec, rdec, cdec may be given')
  
  ##if(length(digits)) .Options$digits6Aug00 what was that?
  
  if(length(digits)) {
oldopt - options(digits=digits)
on.exit(options(oldopt))
  }

  ## For now nsmall and scientific are ignored in R  25May01
  formt -
if(!.R.)
  format.default
else function(x, decimal.mark='.', nsmall=0, scientific=c(-4,4))
{
  x - format(x)
  if(decimal.mark!='.')
x - gsub('\\.',decimal.mark,x)
  
  x
}
  
  dot -
if(cdot)
  (if(.R.)
 'cdotp!'
   else
 '\\cdotp\\!')
else
  '.'

  if(is.data.frame(x))
x - unclass(x)
  
  xtype 

Re: [R] Hmisc latex function

2005-10-11 Thread Marc Schwartz (via MN)
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 35
 b 2 46
  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: No such
file.


The temporary .tex file is present, but the .dvi, .aux and .log files
are created in the current working R directory.

HTH,

Marc Schwartz

__
R-help@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