[R] Hmisc - latex - table.env not observed
The following code library(Hmisc) x = 1:10 y = x latex(summary(x~y),table.env=FALSE) latex(summary(cbind(x,y)),table.env=FALSE) should produce latex output that is not a table. The second one produces just a tabular, as it should. However, the first one produces a tabular embedded in a table. (This is the effect if you leave table.env=FALSE out). __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Hmisc - latex - table.env not observed
steve wrote: The following code library(Hmisc) x = 1:10 y = x latex(summary(x~y),table.env=FALSE) latex(summary(cbind(x,y)),table.env=FALSE) should produce latex output that is not a table. The second one produces just a tabular, as it should. However, the first one produces a tabular embedded in a table. (This is the effect if you leave table.env=FALSE out). summary(x~y) produces a summary.formula.response object and latex.summary.formula.response generates a caption for the table. Whenever latex.default sees a caption it sets table.env to TRUE. You might try the ctable option if you have the ctable style installed in LaTeX or we can think about respecting table.env more fully. But I wouldn't know what to do with the caption then. -- Frank E Harrell Jr Professor and Chair 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 and provide commented, minimal, self-contained, reproducible code.
[R] Hmisc, latex cdec not as expected
Hello all. I have encountered at problem when using the Hmisc package to generate latex-tabels. I can't seem to control the number of digits in the latex-file. I have used the Design and Hmisc packages for a while without this problem, but after upgrading to R-2.4.0 the problem has occured. I have mad a clean installation where I uninstalled all earliere version of R, and I re-installed all packages. Below is a simple example, where the output has 15 digits after the decimal-point. I have then tried to use the 'digits'-option, but that gives an error. R version 2.4.0 (2006-10-03) Copyright (C) 2006 The R Foundation for Statistical Computing ISBN 3-900051-07-0 library(Design) tmp - data.frame(x=c(1.0002, 2.013), y=c(1,2)) tabel - summary(x~y, data=tmp) latex(tabel, cdec=3) latex(tabel, digits=3) Error in format.df(object, dcolumn = dcolumn, na.blank = na.blank, numeric.dollar = numeric.dollar, : only one of digits, dec, rdec, cdec may be given I hope someone can help. With kind regards Henrik __ Henrik F. Thomsen Msc, PhD, statistician [[alternative HTML version deleted]] __ 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 and provide commented, minimal, self-contained, reproducible code.
[R] Hmisc, latex cdec not as expected - again
Hello all. Sorry for reposting this message, but I accedently sent it in HTML-format the first time. I have encountered at problem when using the Hmisc package to generate latex-tabels. I can't seem to control the number of digits in the latex-file. I have used the Design and Hmisc packages for a while without this problem, but after upgrading to R-2.4.0 the problem has occured. I have made a clean installation where I uninstalled all earliere version of R, and I re-installed all packages. Below is a simple example, where the output has 15 digits after the decimal-point. I have then tried to use the 'digits'-option, but that gives an error. R version 2.4.0 (2006-10-03) Copyright (C) 2006 The R Foundation for Statistical Computing ISBN 3-900051-07-0 library(Design) tmp - data.frame(x=c(1.0002, 2.013), y=c(1,2)) tabel - summary(x~y, data=tmp) latex(tabel, cdec=3) latex(tabel, digits=3) Error in format.df(object, dcolumn = dcolumn, na.blank = na.blank, numeric.dollar = numeric.dollar, : only one of digits, dec, rdec, cdec may be given I hope someone can help. With kind regards Henrik __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Hmisc, latex cdec not as expected - again
Henrik Frederik Thomsen HFTH at DCE.AU.DK writes: I have encountered at problem when using the Hmisc package to generate latex-tabels. I can't seem to control the number of digits in the latex-file. I have used the Design and Hmisc packages for a while without this problem, but after upgrading to R-2.4.0 the problem has occured. ... This bug has been confirmed by Frank Harrell and Thomas Dupont on October 25. They are working on it. Dieter __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Hmisc latex cell background color
David Whiting david.whiting at ncl.ac.uk writes: The nearest I got to was to be able to colour row. Take a look at Table 10 here: http://biostat.mc.vanderbilt.edu/twiki/pub/Main/StatReport/latexFineControl.pdf After some private emailing with David and downloading the latest version of the docs, I found the new command \cellcolor in colortbl, which makes coloring of single cells painless. Deter library(Hmisc) x - as.data.frame(diag(rnorm(3),nrow=3)) cellTex - matrix(rep(, NROW(x) * NCOL(x)), nrow=NROW(x)) cellTex[2,2] - \cellcolor{red} ct - latex(x, cellTexCmds = cellTex,numeric.dollar=FALSE) ct$style - colortbl # this forces load of colortbl (not documented?) dvi(ct) __ 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 cell background color
Hi Dieter, The nearest I got to was to be able to colour row. Take a look at Table 10 here: http://biostat.mc.vanderbilt.edu/twiki/pub/Main/StatReport/latexFineControl.pdf I used the latex package colotbl (see the definition of \shadeRow in section 1). I didn't play any further with this. It might be possible that colortbl has further commands ora mechanism for colouring individual cells. Dave Dieter Menne wrote: Dear latex/R-Sweavers, Using the codel below, I can color text in individual cells for latex output. Is there a similar way to get a background shading? My attempts failed because I did not get the closing brace at the right place with Hmisc/latex. library(Hmisc) x - as.data.frame(diag(rnorm(3),nrow=3)) cellTex - matrix(rep(, NROW(x) * NCOL(x)), nrow=NROW(x)) cellTex[2,2] - \color{red} ct - latex(x, cellTexCmds = cellTex,numeric.dollar=FALSE) ct$style - color dvi(ct) Dieter __ 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 -- David Whiting School of Clinical Medical Sciences, The Medical School University of Newcastle upon Tyne, NE2 4HH, UK. In God we trust, all others must bring data W. Edwards Deming __ 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
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:
[R] Hmisc latex cell background color
Dear latex/R-Sweavers, Using the codel below, I can color text in individual cells for latex output. Is there a similar way to get a background shading? My attempts failed because I did not get the closing brace at the right place with Hmisc/latex. library(Hmisc) x - as.data.frame(diag(rnorm(3),nrow=3)) cellTex - matrix(rep(, NROW(x) * NCOL(x)), nrow=NROW(x)) cellTex[2,2] - \color{red} ct - latex(x, cellTexCmds = cellTex,numeric.dollar=FALSE) ct$style - color dvi(ct) Dieter __ 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
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
[R] Hmisc latex format.df by row formatting?
Using Hmisc, I get the following output from format.df (which will feed to latex) Min Q1 Med Mean Q3 Max Age 30 32.5 36 37.50 41.00 49 Height 174 175.0 178 179.00 181.00 188 Weight 68 74.0 78 76.67 79.75 83 Automatic decimal points adjustments does not exactly do what I want in this case. It would be nice to have the same number of decimals row-wise. Is there a simple way to tell format.df to do this? Dieter __ 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 format.df by row formatting?
Dieter Menne dieter.menne at menne-biomed.de writes: Using Hmisc, I get the following output from format.df (which will feed to latex) Min Q1 Med Mean Q3 Max Age 30 32.5 36 37.50 41.00 49 Height 174 175.0 178 179.00 181.00 188 Weight 68 74.0 78 76.67 79.75 83 Automatic decimal points adjustments does not exactly do what I want in this case. It would be nice to have the same number of decimals row-wise. Try something like: xt = t(format.df(t(as.matrix(xt Dieter __ 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
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
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
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
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
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
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
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
[R] Hmisc latex function
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. __ 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
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
[R] Hmisc latex
Hmisc includes a latex function which typesets objects in latex. A great time saver. I am using it to create a large number of tables in a loop in conjuction with prettyNum to place '000s separators in the numbers (i.e. 1,000,000 not 100). This converts the numbers to strings. The Hmisc/latex default is to left justify characters - which doesn't work in this case. Hmisc/latex seems to have lots of options, but not one that I was expecting. I am having trouble specifying column justification. I can specify justification for column labels, column label groups, row labels, even table justification --- but not the justification of the data within the table. I am convinced that I am missing something. Am I? or this just a yet to be coded feature. Thanks in advance. Michaell __ 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