Import Upstream version 3.14-6
Dirk Eddelbuettel
5 years ago
0 | 0 | Package: Hmisc |
1 | Version: 3.14-5 | |
2 | Date: 2014-09-11 | |
1 | Version: 3.14-6 | |
2 | Date: 2014-11-16 | |
3 | 3 | Title: Harrell Miscellaneous |
4 | 4 | Author: Frank E Harrell Jr <f.harrell@vanderbilt.edu>, with |
5 | 5 | contributions from Charles Dupont and many others. |
17 | 17 | LazyLoad: Yes |
18 | 18 | URL: http://biostat.mc.vanderbilt.edu/Hmisc, |
19 | 19 | https://github.com/harrelfe/Hmisc |
20 | Packaged: 2014-09-11 21:00:20 UTC; harrelfe | |
20 | Packaged: 2014-11-21 18:05:11 UTC; harrelfe | |
21 | 21 | NeedsCompilation: yes |
22 | 22 | Repository: CRAN |
23 | Date/Publication: 2014-09-12 15:50:33 | |
23 | Date/Publication: 2014-11-22 00:42:24 |
0 | 0 | 16f8ea43efba90112351c5ecb33021c4 *COPYING |
1 | 28b724e3db7594714c1ab685e1b877f3 *DESCRIPTION | |
1 | 3c38884e849267c86148b87c6e843631 *DESCRIPTION | |
2 | 2 | 17da8e77284bb353c8e685a3c47a669d *INDEX |
3 | 6b76cfc1cd8c7205a7a46f26c3a2f18d *NAMESPACE | |
4 | 716a51594604fcc74f0aa34a8ca7a118 *NEWS | |
3 | a8b838ef66b469e2b6ae849e3f96f74a *NAMESPACE | |
4 | 57f1318c607746fb3bd8c6ec3c4a9c11 *NEWS | |
5 | 5 | 76f90acbe9bf8ad2eaaa6b8813eb7c82 *R/AFirst.lib.s |
6 | 6 | 62ef16fc333551d6c65f15dedfb5a697 *R/Cs.s |
7 | 7 | 387ca68eeb2830ad1d19cdbd979cef6e *R/Key.s |
21 | 21 | 8c002470a851e0d14571cfda085e6c42 *R/confbar.s |
22 | 22 | 1274fe9b36deb504e596de1fc99cdbcb *R/consolidate.s |
23 | 23 | c04e31869fdc5107eb6af6886eadb566 *R/cpower.s |
24 | a0d62412137930c872a577dc5ea139c2 *R/curveRep.s | |
24 | 45de10ab5edf3d2a193a8617fe6128f4 *R/curveRep.s | |
25 | 25 | 5da6635f342086cedeee652e296ce9e1 *R/cut2.s |
26 | 26 | 25c501e1db065dacd0b7ebbc9918254e *R/data.frame.labelled.s |
27 | 27 | 97dc5dcc48cb719088b817833067352c *R/dataRep.s |
28 | 28 | 8ef7d2efc9aa8c82dcdb3073d48477ae *R/dates.s |
29 | 29 | 3f02d2486d14e095a96fe5ee10e483c7 *R/deff.s |
30 | 1e1f95133698fda2a768f668e276e98d *R/describe.s | |
30 | c836746571a4ea73ad482de3c552debe *R/describe.s | |
31 | 31 | 6cb5b3a77860b605f102bb528e84a071 *R/discrete.s |
32 | 32 | a96e8a7c59626e7cb975f79eb869b025 *R/dotchart3.s |
33 | 33 | 01ac1a5622f257498eefc940f11c8615 *R/ecdf.s |
51 | 51 | 8cf9e0a10997c59a5be3f19a39c73684 *R/james.stein.s |
52 | 52 | 88c72d01c0b5a4f5d40f919918bfbd00 *R/labcurve.s |
53 | 53 | df6cc0711c0f32bd8524560fc403dbff *R/label.s |
54 | 8fc31a2fcfe7d0aa1abc9dd2e5188eae *R/latex.s | |
54 | f20844d838120469e5167a1933e90071 *R/latex.s | |
55 | 55 | 15f9f1d9ce01c4624523182f7a514244 *R/latexDotchart.s |
56 | 56 | 9fafa76ce37fa2f42c27236c9bbcfb9d *R/latexTabular.s |
57 | 57 | 330de4a4106a11330d54434e2d7a8c32 *R/latexTherm.s |
61 | 61 | e21c3cbb9b9c17b07223d4f805433395 *R/makeNstr.s |
62 | 62 | e5f0eef89d954522d56fb5399066a6d3 *R/mask.s |
63 | 63 | f4cc097babcda3c1edcd60f516713ff2 *R/matxv.s |
64 | f0d3e83235352d62cc0714846821c68e *R/mdb.get.s | |
64 | c43b31317d74ac389aff80c7adf7efa5 *R/mdb.get.s | |
65 | 65 | 1c430f0b7f3caed1b15359483136509d *R/minor.tick.s |
66 | 66 | 32a369e847b95005134970ac15b4ba73 *R/model.frame.default.s |
67 | 67 | fc71dbaeeb57983dcfa3ac0497ed837b *R/mtitle.s |
76 | 76 | 215f9a06ffc6df02fb67576ad0da83b9 *R/panel.abwplot.s |
77 | 77 | 35e90e268046316b9369585f790bdd9a *R/panel.bpplot.s |
78 | 78 | 1630c1be85251dac0e8cd0243bedd201 *R/pc1.s |
79 | 187f93b46f9d3d54258618f1cb7a1333 *R/plsmo.s | |
79 | b4c352cd36449e5ec442b9badb45c9d2 *R/plsmo.s | |
80 | 80 | ce22555a4a09e120b39f9eec3320b37c *R/popower.s |
81 | 81 | 9a1119c7949407c39968645e921a87a6 *R/print.char.list.s |
82 | 82 | afe3fb9a3b0fa665e0811fd2b1ace401 *R/pstamp.s |
109 | 109 | b42e6d7953adef86625842fa4bdbe291 *R/strwrap.s |
110 | 110 | 055ef617ac4b0362b6466e6436ba69fb *R/subplot.s |
111 | 111 | 14e533b635192fae8b28ca81b9c86f5d *R/substi.s |
112 | fb4587629a1bb412968b1c55092900c3 *R/summary.formula.s | |
113 | e820a611b7ad0ef9fa7c8a4751a74839 *R/summaryM.s | |
112 | abcd76fbff84661c057ae17869fecc40 *R/summary.formula.s | |
113 | da2e1714f9e6874e265dedf924bb2fb5 *R/summaryM.s | |
114 | 114 | 7968792139f8f165a2725d04be6d7600 *R/summaryP.s |
115 | 115 | dc27150ba262b8c3844ce46d36f1e492 *R/summaryRc.s |
116 | 116 | 598051fb147f0879ecb04ad4a0dfe54f *R/summaryS.s |
125 | 125 | 91c82b7b8e9ad8cff084bf7b2069d11b *R/units.s |
126 | 126 | 25b2e4d51ba3475a3e2bd22da07305ad *R/valueTags.s |
127 | 127 | ce9c8d4ed31e5172583f329e103dcbe4 *R/varclus.s |
128 | 02c2c59f781d8c3433c0b4ffae2f54d4 *R/wtd.stats.s | |
128 | 6fb48df83188e5a99022fdcfb106cb0e *R/wtd.stats.s | |
129 | 129 | fafd82249f6870351f42d4ad6c3757c5 *R/xYplot.s |
130 | 130 | ceb40edad1b482275efde229ce48cdea *R/xtfrm.labelled.s |
131 | 131 | b72b2ab287d4c1af9d741022300a18bb *R/xy.group.s |
142 | 142 | d04e0431bff384660d258b2e2e405b32 *man/Hmisc-internal.Rd |
143 | 143 | a8d3213ffdeb74c3f50bb2d54a8b9ab5 *man/Lag.Rd |
144 | 144 | 1dcfad836f562a867431ea9225ef009d *man/Misc.Rd |
145 | 81e0509297dea67156903a55e89339b4 *man/Overview.Rd | |
145 | 0beff88dfa85ab0fd7b4306272170a8f *man/Overview.Rd | |
146 | 146 | 0b14624c4cf49f60e6447e2792b227c6 *man/Save.Rd |
147 | 147 | 6512b9f5df15df6558a987169ebbc216 *man/abs.error.pred.Rd |
148 | 148 | ccb2959a926f28700383197d9496151d *man/addMarginal.Rd |
160 | 160 | d787d413eeb83e8f9cd809d4630a9f99 *man/ciapower.Rd |
161 | 161 | 4202bd798ad52004eec93d91b0a8d945 *man/cnvrt.coords.Rd |
162 | 162 | 00db76a86189178fe8385d5aaeda346b *man/consolidate.Rd |
163 | 214346eb5560c930d14d2318c26959d9 *man/contents.Rd | |
163 | e94ba9a8822c12a12ed1fa3c5f3526f2 *man/contents.Rd | |
164 | 164 | 11c78317d89330da550b16617b3b96a6 *man/cpower.Rd |
165 | 165 | 5673d004d5398e681cc11521217a38ca *man/csv.get.Rd |
166 | 588c98170b6ff457695cfe40cc409f78 *man/curveRep.Rd | |
166 | 3189e5ba69e3ed68dfbe16b8272837eb *man/curveRep.Rd | |
167 | 167 | 8837df3d98894a30648d941bed708600 *man/cut2.Rd |
168 | 168 | 3f0207be8386db756a98655b26cc21be *man/data.frame.create.modify.check.Rd |
169 | 169 | 2ead582aeae9e126400a6b4ad683e264 *man/dataRep.Rd |
195 | 195 | 216bb0989ebf4378cb87841082451438 *man/inc-dec.Rd |
196 | 196 | 40974ee6be081e636f57e6649b6fde38 *man/labcurve.Rd |
197 | 197 | c9a14ef836c70a6c1ba034f40505006b *man/label.Rd |
198 | c7bdf4b6b293f2382bd9cb95884e5f4c *man/latex.Rd | |
198 | acb1fe98c820d282892d7a63cb1ee43c *man/latex.Rd | |
199 | 199 | 211c0afb26e58d9aee079d5ee9bebc95 *man/latexDotchart.Rd |
200 | 200 | 27998cfcd912e12c8ca2a0ae72a0f3fb *man/latexTabular.Rd |
201 | 201 | 0bc6e69386de30a3e231170b3d19a218 *man/latexTherm.Rd |
204 | 204 | 7a3ad23a76192d3d91b2995a098bfabb *man/mApply.Rd |
205 | 205 | 6aaa5648e29fa7bbbffcc6abb94a003e *man/mChoice.Rd |
206 | 206 | c2c3d7fd7b6118a5480308fcacb57afa *man/makeNstr.Rd |
207 | 15299005b391107453578c49e8b3f75a *man/mdb.get.Rd | |
207 | 7b897bfa6c2c3500b188ef4db8b3c112 *man/mdb.get.Rd | |
208 | 208 | 02d1f868b81a79ca95f29a1237ffea4e *man/mgp.axis.Rd |
209 | 209 | 3808e059fc503259824eb5cc2bc0b621 *man/minor.tick.Rd |
210 | 210 | d513cb5e98a79934c27f37e090d9c849 *man/mtitle.Rd |
258 | 258 | 9a4cac30cfc22acf2afa062a30b62d9c *man/stringDims.Rd |
259 | 259 | bbd0b4524bd9a4e350d6a7ad4aca3a0a *man/subplot.Rd |
260 | 260 | 5f57bda18966651336d67c9815a4a735 *man/summarize.Rd |
261 | 0944ea9a5cd83e6c55f5101b72b16510 *man/summary.formula.Rd | |
262 | c993d780a236a0b93067be0df044df6e *man/summaryM.Rd | |
261 | f01235c13973dda377b308305ef2c522 *man/summary.formula.Rd | |
262 | 5280d7d8d537e0bde0b0628e742b337c *man/summaryM.Rd | |
263 | 263 | 83d5ba5f470f16b143e9dc9505789054 *man/summaryP.Rd |
264 | 264 | 7ca4294ccd0452d806afe92197d4b6c5 *man/summaryRc.Rd |
265 | 265 | e82661d26ccd2ab7689b3cb63113c65d *man/summaryS.Rd |
278 | 278 | 05327becfe12abbbc92e8f5c342197a5 *man/valueTags.Rd |
279 | 279 | 5b38e2511ce2b1f47cbb217211b5a803 *man/varclus.Rd |
280 | 280 | bc5f53ee64bd18f64dd31271902608ca *man/windows/sas.get.Rd |
281 | 3829ebdffaf2cff78fb395416b9dbb5f *man/wtd.stats.Rd | |
281 | bb8aba91aba23e8359f046a3cf7854ad *man/wtd.stats.Rd | |
282 | 282 | 7bcbae4f32d3a80d4bcd721f45aa9ede *man/xYplot.Rd |
283 | 283 | 13c3f8a542f16076e346f9d6cc7904c3 *man/xtfrm.labelled.Rd |
284 | 284 | 83b8f2732a6c378785187242ff93b26a *man/xy.group.Rd |
324 | 324 | bc723e6e82c91373f2c3f142bbe0be59 *tests/inverseFunction.r |
325 | 325 | 573465e16901912adb87c138b62056c6 *tests/largest.empty.r |
326 | 326 | a1e0437dadc110e13e67c1f72235bfb5 *tests/latex.s |
327 | 665a97c81e3fafa665ec1365a9997242 *tests/latex.summaryM.Rnw | |
327 | 969b3b3132b54e2b4a174e8c251338b0 *tests/latex.summaryM.Rnw | |
328 | 328 | 86bb29e3df2c4cc1dab74549971ca150 *tests/latexTherm.Rnw |
329 | 329 | 2a119079fd599b3fd6f64b6f579de087 *tests/latexTherm.r |
330 | 330 | c0668a4323dcc6d83736668c00456d23 *tests/minor.tick.r |
22 | 22 | S3method(plot, summaryS) |
23 | 23 | S3method(label, default) |
24 | 24 | S3method(label, data.frame) |
25 | S3method('label<-', default) | |
26 | S3method('label<-', data.frame) | |
27 | S3method('[', labelled) | |
28 | S3method(print, labelled) | |
25 | 29 | S3method(label, Surv) |
26 | 30 | S3method(units, default) |
27 | 31 | S3method(units, Surv) |
0 | Changes in version 3.14-6 (2014-11-16) | |
1 | * wtd.rank: fixed bug in no weights case (thanks: DPlat) | |
2 | * latex.summaryM, latex.summary.formula.reverse: added npct='slash' to present numerators and denominators horizontally instead of vertically | |
3 | * plsmo: put derivation of ylab earlier so will use original attributes | |
4 | * NAMESPACE: exported more S3 methods for label | |
5 | * contents: added arguments id, range, values | |
6 | * print.contents.data.frame, html.contents.data.frame: added maxlevels argument | |
7 | * curveRep: added option to have the color of frequencies displayed match line colors. Thanks: jstat10 | |
8 | * curveRep: changed call to strwidth to use units instead of unit argument | |
9 | * contents.data.frame: corrected omission in help file | |
10 | * wtd.var: corrected denominator. Thanks: Shan Huang | |
11 | * latex.default: changed to use colheads=FALSE to suppress column headings. Thanks: Michael Rose | |
12 | * mdb.get: added system option -b strip to mdb-export to skip binary output | |
13 | ||
0 | 14 | Changes in version 3.14-5 (2014-09-11) |
1 | 15 | * latex.summaryM: fixed bug in caption with test=TRUE. Thanks: Yonghao Pua |
2 | 16 | * csv.get: uses data.table package's fread in place of read.csv if data.table is in effect |
0 | ## $Id$ | |
1 | 0 | curveRep <- function(x, y, id, kn=5, kxdist=5, k=5, p=5, force1=TRUE, |
2 | 1 | metric=c('euclidean','manhattan'), |
3 | 2 | smooth=FALSE, extrap=FALSE, pr=FALSE) { |
143 | 142 | nx=NULL, fill=TRUE, |
144 | 143 | idcol=NULL, freq=NULL, plotfreq=FALSE, |
145 | 144 | xlim=range(x), ylim=range(y), |
146 | xlab='x', ylab='y', ...) { | |
145 | xlab='x', ylab='y', colorfreq=FALSE, ...) { | |
147 | 146 | method <- match.arg(method) |
148 | 147 | ncuts <- x$ncuts |
149 | 148 | res <- x$res; id <- x$id; y <- x$y; k <- x$k; x <- x$x |
235 | 234 | return() |
236 | 235 | } |
237 | 236 | txt <- paste(names(tab), tab, sep=':') |
237 | txt2 <- txt | |
238 | 238 | paste(txt, collapse=';') |
239 | 239 | } else { |
240 | 240 | size <- sizecluster[subscripts[1]] |
241 | 241 | paste('N=',size,sep='') |
242 | 242 | } |
243 | grid.text(txt, x=.005, y=.99, just=c(0,1), | |
244 | gp=gpar(fontsize=9, col=gray(.25))) | |
243 | if (!colorfreq | is.null(idcol) | is.null(freq)) #Do same as original | |
244 | { | |
245 | grid.text(txt, x = 0.005, y = 0.99, just = c(0, 1), | |
246 | gp = gpar(fontsize = 9, col = gray(0.25))) | |
247 | } | |
248 | else #color freq text using idcol | |
249 | { | |
250 | mycolors<-data.frame(idcol,freq) | |
251 | mycolors<-unique(mycolors) | |
252 | curtext<-txt2[1] | |
253 | curtrt<-strsplit(curtext,':')[[1]][1] | |
254 | curcol<-as.character( mycolors[ curtrt==as.character( mycolors[,2]) ,1] ) | |
255 | ||
256 | grid.text(curtext, | |
257 | x = 0.005, | |
258 | y = 0.99, | |
259 | just = c(0, 1), | |
260 | gp = gpar(fontsize = 9, col =curcol) | |
261 | ) | |
262 | emspace<-2*strwidth('M', units="figure") | |
263 | for (i in 2:length(txt2)) | |
264 | { | |
265 | curtext<-txt2[i] | |
266 | curtrt<-strsplit(curtext,':')[[1]][1] | |
267 | curcol<-as.character( mycolors[ curtrt==as.character( mycolors[,2]) ,1] ) | |
268 | ||
269 | grid.text(curtext, | |
270 | x = emspace+strwidth(txt2[i-1], units="figure") , | |
271 | y = 0.99, just = c(0, 1), | |
272 | gp = gpar(fontsize = 9, col = curcol) | |
273 | ) | |
274 | } | |
275 | } | |
245 | 276 | } |
246 | 277 | pan <- if(length(idcol)) |
247 | 278 | function(x, y, subscripts, groups, type, ...) { |
685 | 685 | |
686 | 686 | contents <- function(object, ...) UseMethod('contents') |
687 | 687 | |
688 | contents.data.frame <- function(object, sortlevels=FALSE, ...) | |
688 | contents.data.frame <- function(object, sortlevels=FALSE, | |
689 | id=NULL, range=NULL, values=NULL, ...) | |
689 | 690 | { |
690 | 691 | dfname <- deparse(substitute(object)) |
691 | 692 | nam <- names(object) |
697 | 698 | for(i in 1:n) { |
698 | 699 | x <- object[[i]] |
699 | 700 | at <- attributes(x) |
700 | if(length(at$label)) | |
701 | lab[i] <- at$label | |
702 | if(length(at$longlabel)) | |
703 | longlab[i] <- at$longlabel | |
704 | ||
705 | if(length(at$units)) | |
706 | un[i] <- at$units | |
701 | if(length(at$label)) lab[i] <- at$label | |
702 | if(length(at$longlabel)) longlab[i] <- at$longlabel | |
703 | ||
704 | if(length(at$units)) un[i] <- at$units | |
707 | 705 | |
708 | 706 | atl <- at$levels |
709 | 707 | fl[i] <- length(atl) |
710 | cli <- at$class[at$class %nin% c('labelled','factor')] | |
711 | if(length(cli)) | |
712 | cl[i] <- cli[1] | |
708 | cli <- at$class[at$class %nin% c('labelled', 'factor')] | |
709 | if(length(cli)) cl[i] <- cli[1] | |
713 | 710 | |
714 | 711 | sm[i] <- storage.mode(x) |
715 | 712 | nas[i] <- sum(is.na(x)) |
716 | 713 | if(length(atl)) { |
717 | 714 | if(sortlevels) atl <- sort(atl) |
718 | if(length(Lev)) for(j in 1:length(Lev)) { | |
715 | if(length(Lev)) for(j in 1 : length(Lev)) { | |
719 | 716 | w <- Lev[[j]] |
720 | 717 | if(!is.name(w) && is.logical(all.equal(w, atl))) { |
721 | 718 | atl <- as.name(names(Lev)[j]) |
726 | 723 | } |
727 | 724 | } |
728 | 725 | |
729 | w <- list(Labels=if(any(lab!='')) lab, | |
730 | Units=if(any(un!='')) un, | |
731 | Levels=if(any(fl>0)) fl, | |
732 | Class=if(any(cl!='')) cl, | |
733 | Storage= sm, | |
734 | NAs=if(any(nas>0)) nas ) | |
735 | ||
736 | w <- w[sapply(w, function(x)length(x)>0)] | |
726 | w <- list(Labels = if(any(lab != '')) lab, | |
727 | Units = if(any(un != '')) un, | |
728 | Levels = if(any(fl > 0)) fl, | |
729 | Class = if(any(cl != '')) cl, | |
730 | Storage= sm, | |
731 | NAs = if(any(nas > 0)) nas ) | |
732 | ||
733 | w <- w[sapply(w, function(x)length(x) > 0)] | |
737 | 734 | |
738 | 735 | ## R does not remove NULL elements from a list |
739 | 736 | structure(list(contents=data.frame(w, row.names=nam), |
740 | dim=d, maxnas=max(nas), dfname=dfname, | |
737 | dim=d, maxnas=max(nas), | |
738 | id=id, rangevar=range, valuesvar=values, | |
739 | unique.ids = if(length(id) && id %in% nam) | |
740 | length(unique(object[[id]])), | |
741 | range = if(length(range) && range %in% nam) | |
742 | paste(as.character(range(object[[range]], na.rm=TRUE)), | |
743 | collapse='-'), | |
744 | values = if(length(values) && values %in% nam) | |
745 | paste(if(is.factor(object[[values]])) levels(object[[values]]) | |
746 | else sort(unique(object[[values]])), collapse=' '), | |
747 | dfname=dfname, | |
741 | 748 | Levels=Lev, |
742 | longLabels=if(any(longlab!='')) structure(longlab, names=nam)), | |
749 | longLabels=if(any(longlab!='')) | |
750 | structure(longlab, names=nam)), | |
743 | 751 | class='contents.data.frame') |
744 | 752 | } |
745 | 753 | |
746 | 754 | |
747 | 755 | print.contents.data.frame <- |
748 | 756 | function(x, sort=c('none','names','labels','NAs'), |
749 | prlevels=TRUE, number=FALSE, ...) | |
757 | prlevels=TRUE, maxlevels=Inf, number=FALSE, ...) | |
750 | 758 | { |
751 | 759 | sort <- match.arg(sort) |
752 | 760 | d <- x$dim |
753 | 761 | maxnas <- x$maxnas |
754 | cat('\nData frame:',x$dfname,'\t',d[1],' observations and ',d[2], | |
755 | ' variables Maximum # NAs:',maxnas,'\n\n',sep='') | |
762 | cat('\nData frame:', x$dfname, '\t', d[1],' observations and ', d[2], | |
763 | ' variables Maximum # NAs:', maxnas, '\n', sep='') | |
764 | if(length(x$id)) cat('Unique ', x$id, ':', x$unique.ids, '\t', sep='') | |
765 | if(length(x$rangevar)) cat(x$rangevar, ' range:', x$range, '\t', sep='') | |
766 | if(length(x$valuesvar))cat(x$valuesvar, ':', x$values, sep='') | |
767 | cat('\n\n') | |
756 | 768 | cont <- x$contents |
757 | 769 | nam <- row.names(cont) |
758 | 770 | if(number) row.names(cont) <- paste(format(1:d[2]), row.names(cont)) |
763 | 775 | }, |
764 | 776 | labels={ |
765 | 777 | if(length(cont$Labels)) |
766 | cont <- cont[order(cont$Labels, nam),,drop=FALSE] | |
778 | cont <- cont[order(cont$Labels, nam),, drop=FALSE] | |
767 | 779 | }, |
768 | 780 | NAs={ |
769 | if(maxnas>0) | |
770 | cont <- cont[order(cont$NAs,nam),,drop=FALSE] | |
781 | if(maxnas > 0) | |
782 | cont <- cont[order(cont$NAs, nam),, drop=FALSE] | |
771 | 783 | }) |
772 | 784 | |
773 | 785 | if(length(cont$Levels)) |
774 | cont$Levels <- ifelse(cont$Levels==0,'',format(cont$Levels)) | |
786 | cont$Levels <- ifelse(cont$Levels == 0, '', format(cont$Levels)) | |
775 | 787 | |
776 | 788 | print(cont) |
777 | 789 | |
778 | 790 | if(prlevels && length(L <- x$Levels)) { |
779 | 791 | cat('\n') |
780 | 792 | nam <- names(L) |
781 | w <- .Options$width-max(nchar(nam))-5 | |
793 | w <- .Options$width - max(nchar(nam)) - 5 | |
782 | 794 | reusingLevels <- sapply(L, is.name) |
783 | fullLevels <- which(!reusingLevels) | |
795 | fullLevels <- which(!reusingLevels) | |
784 | 796 | namf <- lin <- names(L[fullLevels]) |
785 | 797 | ## separate multiple lines per var with \n for print.char.matrix |
786 | 798 | j <- 0 |
787 | for(i in fullLevels) | |
788 | { | |
789 | j <- j + 1 | |
790 | varsUsingSame <- NULL | |
791 | if(sum(reusingLevels)) | |
792 | { | |
793 | for(k in which(reusingLevels)) if(L[[k]] == namf[j]) | |
794 | varsUsingSame <- c(varsUsingSame, nam[k]) | |
795 | if(length(varsUsingSame)) | |
796 | namf[j] <- paste(c(namf[j], varsUsingSame), collapse='\n') | |
797 | } | |
798 | lin[j] <- paste(pasteFit(L[[i]], width=w), collapse='\n') | |
799 | for(i in fullLevels) { | |
800 | j <- j + 1 | |
801 | varsUsingSame <- NULL | |
802 | if(sum(reusingLevels)) { | |
803 | for(k in which(reusingLevels)) | |
804 | if(L[[k]] == namf[j]) varsUsingSame <- c(varsUsingSame, nam[k]) | |
805 | if(length(varsUsingSame)) | |
806 | namf[j] <- paste(c(namf[j], varsUsingSame), collapse='\n') | |
799 | 807 | } |
808 | Li <- L[[i]] | |
809 | if(length(Li) > maxlevels) Li <- c(Li[1 : maxlevels], '...') | |
810 | lin[j] <- paste(pasteFit(Li, width=w), collapse='\n') | |
811 | } | |
800 | 812 | z <- cbind(Variable=namf, Levels=lin) |
801 | 813 | print.char.matrix(z, col.txt.align='left', col.name.align='left', |
802 | 814 | row.names=TRUE, col.names=TRUE) |
822 | 834 | |
823 | 835 | |
824 | 836 | html.contents.data.frame <- |
825 | function(object, sort=c('none','names','labels','NAs'), prlevels=TRUE, | |
826 | file=paste('contents',object$dfname,'html',sep='.'), | |
827 | levelType=c('list','table'), | |
837 | function(object, sort=c('none', 'names', 'labels', 'NAs'), prlevels=TRUE, | |
838 | maxlevels=Inf, file=paste('contents',object$dfname, 'html', sep='.'), | |
839 | levelType=c('list', 'table'), | |
828 | 840 | append=FALSE, number=FALSE, nshow=TRUE, ...) |
829 | 841 | { |
830 | 842 | sort <- match.arg(sort) |
831 | 843 | levelType <- match.arg(levelType) |
832 | 844 | d <- object$dim |
833 | 845 | maxnas <- object$maxnas |
834 | if(nshow) | |
846 | if(nshow) { | |
835 | 847 | cat('<hr><h2>Data frame:',object$dfname, |
836 | 848 | '</h2>',d[1], |
837 | 849 | ' observations and ',d[2], |
838 | ' variables, maximum # NAs:',maxnas,'<hr>\n',sep='', | |
839 | file=file, append=append) | |
840 | else | |
850 | ' variables, maximum # NAs:',maxnas, '    ', | |
851 | sep='', file=file, append=append) | |
852 | if(length(object$id)) cat('Unique ', object$id, ':', object$unique.ids, | |
853 | '    ', | |
854 | sep='', file=file, append=TRUE) | |
855 | if(length(object$rangevar)) cat(object$rangevar, ' range:', object$range, | |
856 | '    ', sep='', file=file, append=TRUE) | |
857 | if(length(object$valuesvar))cat(object$valuesvar, ':', object$values, | |
858 | '    ', sep='', file=file, append=TRUE) | |
859 | cat('<hr>\n', file=file, append=TRUE) | |
860 | } else | |
841 | 861 | cat('<hr><h2>Data frame:',object$dfname, |
842 | 862 | '</h2>', ' Variables:', d[2], '<hr>\n', sep='', |
843 | 863 | file=file, append=append) |
893 | 913 | |
894 | 914 | cat('<hr>\n', file=file, append=TRUE) |
895 | 915 | |
896 | if(prlevels && length(L)) { | |
916 | if(prlevels && length(L) > 0) { | |
897 | 917 | if(levelType=='list') { |
898 | 918 | cat('<h2 align="center">Category Levels</h2>\n', file=file, append=TRUE) |
899 | 919 | for(i in fullLevels) { |
907 | 927 | paste(w, collapse=', '), '</h3>\n', sep='', |
908 | 928 | file=file, append=TRUE) |
909 | 929 | cat('<ul>\n', file=file, append=TRUE) |
930 | if(length(l) > maxlevels) l <- c(l[1 : maxlevels], '...') | |
910 | 931 | for(k in l) cat('<li>', k, '</li>\n', sep='', |
911 | 932 | file=file, append=TRUE) |
912 | 933 | cat('</ul>\n', file=file, append=TRUE) |
917 | 938 | ## possible into n elements, pasting multiple elements |
918 | 939 | ## together when needed |
919 | 940 | evenSplit <- function(x, n) { |
920 | indent <- function(z) if(length(z)==1)z else | |
921 | c(z[1], paste('   ',z[-1],sep='')) | |
941 | indent <- function(z) if(length(z) == 1) z else | |
942 | c(z[1], paste('   ', z[-1], sep='')) | |
922 | 943 | m <- length(x) |
923 | 944 | if(m <= n) return(c(indent(x), rep('',n-m))) |
924 | 945 | totalLength <- sum(nchar(x)) + (m-1)*3.5 |
933 | 954 | if(m <= n) break |
934 | 955 | } |
935 | 956 | ## Take evasive action if needed |
936 | if(m==n) indent(y) else if(m < n) | |
937 | c(indent(y), rep('', n-m)) else | |
938 | c(paste(x, collapse=', '), rep('',n-1)) | |
957 | if(m == n) indent(y) else if(m < n) | |
958 | c(indent(y), rep('', n - m)) else | |
959 | c(paste(x, collapse=', '), rep('', n - 1)) | |
939 | 960 | } |
940 | 961 | nam <- names(L) |
941 | 962 | v <- lab <- lev <- character(0) |
943 | 964 | for(i in fullLevels) { |
944 | 965 | j <- j + 1 |
945 | 966 | l <- L[[i]] |
967 | if(length(l) > maxlevels) l <- c(l[1 : maxlevels], '...') | |
946 | 968 | nami <- nam[i] |
947 | 969 | v <- c(v, nami) |
948 | 970 | w <- nami |
381 | 381 | double.slash=double.slash, ...) |
382 | 382 | if (missing(rowname)) |
383 | 383 | rowname <- dimnames(cx)[[1]] |
384 | ||
385 | nocolheads <- length(colheads) == 1 && is.logical(colheads) && ! colheads | |
384 | 386 | |
385 | 387 | if (!length(colheads)) |
386 | 388 | colheads <- dimnames(cx)[[2]] |
742 | 744 | labs <- colheads |
743 | 745 | if (length(colnamesTexCmd)) |
744 | 746 | labs <- paste(sl, colnamesTexCmd, " ", labs, sep="") |
747 | if(nocolheads) colheads <- labs <- NULL | |
745 | 748 | header <- NULL |
746 | 749 | if(length(labs)) { |
747 | 750 | if(!length(extracolheads)) { |
754 | 757 | if(multicol) |
755 | 758 | colheads <- paste(slmc1, cvbar, "}{", colheads, "}", sep="") |
756 | 759 | |
757 | header <- paste(colheads, collapse='&') | |
760 | header <- if(length(colheads)) paste(colheads, collapse='&') | |
758 | 761 | if(length(extracolheads)) { |
759 | 762 | extracolheads <- ifelse(extracolheads == ''| extracolsize == '', |
760 | 763 | extracolheads, |
768 | 771 | extracolheads <- ifelse(extracolheads == '',extracolheads, |
769 | 772 | paste(extracolheads,sep='')) |
770 | 773 | |
771 | header <- paste(header, eol, paste(extracolheads, collapse='&'), sep='') | |
774 | header <- if(length(header)) | |
775 | paste(header, eol, paste(extracolheads, collapse='&'), sep='') | |
772 | 776 | } |
773 | 777 | |
774 | cat(header, eog, file=file, sep='', append=file!='') | |
778 | if(length(header)) cat(header, eog, file=file, sep='', append=file!='') | |
775 | 779 | |
776 | 780 | if(ctable) |
777 | 781 | cat(midrule, file=file, append=file!='') |
791 | 795 | cat(midrule, sep="",file=file, append=file!='') |
792 | 796 | if(length(cgroupheader)) |
793 | 797 | cat(cgroupheader, file=file, append=file!='') |
794 | cat(header, file=file, sep="&", append=file!='') | |
798 | if(length(header)) cat(header, file=file, sep="&", append=file!='') | |
795 | 799 | cat(eog, midrule, sl, "endhead", '\n', midrule, |
796 | 800 | sep="", file=file, append=file!='') |
797 | 801 | if(length(insert.bottom)) { |
22 | 22 | if(lowernames) vnames <- casefold(vnames) |
23 | 23 | types <- sapply(s, function(x)x[length(x)]) |
24 | 24 | datetime <- vnames[grep('DateTime', s)] |
25 | system(paste('mdb-export', file, shQuote(tab), '>', f)) | |
25 | system(paste('mdb-export -b strip', file, shQuote(tab), '>', f)) | |
26 | 26 | d <- csv.get(f, datetimevars=datetime, |
27 | 27 | lowernames=lowernames, allow=allow, |
28 | 28 | dateformat=dateformat, ...) |
9 | 9 | gfun <- ordGridFun(grid) |
10 | 10 | nam <- as.character(sys.call())[2 : 3] |
11 | 11 | method <- match.arg(method) |
12 | if(missing(ylab)) | |
13 | ylab <- label(y, units=TRUE, plot=TRUE, default=nam[2]) | |
12 | 14 | Y <- as.matrix(y) |
13 | 15 | p <- ncol(Y) |
14 | 16 | if(!missing(subset)) { |
83 | 85 | else { |
84 | 86 | if(missing(xlab)) |
85 | 87 | xlab <- label(x, units=TRUE, plot=TRUE, default=nam[1]) |
86 | if(missing(ylab)) | |
87 | ylab <- label(Y, units=TRUE, plot=TRUE, default=nam[2]) | |
88 | ||
88 | ||
89 | 89 | if(missing(xlim)) xlim <- c(xmin, xmax) |
90 | 90 | if(missing(ylim)) ylim <- c(ymin, ymax) |
91 | 91 | plot(xmin, ymin, xlim=xlim, ylim=ylim, |
1469 | 1469 | switch(npct, |
1470 | 1470 | numerator=paste('{\\',npct.size,' (',format(tab),')}',sep=''), |
1471 | 1471 | denominator=paste('{\\',npct.size,' of',denom.rep,'}'), |
1472 | both=paste('{\\',npct.size,' $\\frac{', | |
1473 | format(tab),'}{',denom.rep, | |
1474 | '}$}',sep='')) | |
1472 | both=paste('{\\', npct.size, ' $\\frac{', format(tab),'}{', | |
1473 | denom.rep,'}$}',sep=''), | |
1474 | slash=paste('~{\\', npct.size, ' ', format(tab), | |
1475 | '\\,/\\,', # \, = LaTeX thin space | |
1476 | denom.rep, '}', sep='') | |
1477 | ) | |
1475 | 1478 | else |
1476 | 1479 | switch(npct, |
1477 | 1480 | numerator=paste('(',format(tab),')',sep=''), |
1754 | 1757 | function(object, title=first.word(deparse(substitute(object))), |
1755 | 1758 | digits, prn = any(n!=N), pctdig=0, |
1756 | 1759 | what=c('%', 'proportion'), |
1757 | npct=c('numerator','both','denominator','none'), | |
1760 | npct=c('numerator','both','denominator','slash','none'), | |
1758 | 1761 | npct.size='scriptsize', Nsize='scriptsize', |
1759 | 1762 | exclude1=TRUE, vnames=c("labels","names"), prUnits=TRUE, |
1760 | 1763 | middle.bold=FALSE, outer.size="scriptsize", |
557 | 557 | file=paste(title, 'tex', sep='.'), append=FALSE, |
558 | 558 | digits, prn = any(n!=N), |
559 | 559 | what=c('proportion', '%'), pctdig=if(what=='%') 0 else 2, |
560 | npct=c('numerator','both','denominator','none'), | |
560 | npct=c('numerator','both','denominator','slash','none'), | |
561 | 561 | npct.size='scriptsize', Nsize='scriptsize', |
562 | 562 | exclude1=TRUE, vnames=c("labels","names"), prUnits=TRUE, |
563 | 563 | middle.bold=FALSE, outer.size="scriptsize", |
24 | 24 | } |
25 | 25 | |
26 | 26 | if(normwt) |
27 | weights <- weights*length(x)/sum(weights) | |
28 | ||
29 | xbar <- sum(weights*x)/sum(weights) | |
30 | sum(weights*((x - xbar)^2)) / (sum(weights) - 1) | |
27 | weights <- weights * length(x) / sum(weights) | |
28 | ||
29 | sw <- sum(weights) | |
30 | xbar <- sum(weights * x) / sw | |
31 | sum(weights*((x - xbar)^2)) / (sw - sum(weights ^ 2) / sw) | |
31 | 32 | } |
32 | 33 | |
33 | 34 | |
182 | 183 | wtd.rank <- function(x, weights=NULL, normwt=FALSE, na.rm=TRUE) |
183 | 184 | { |
184 | 185 | if(!length(weights)) |
185 | return(rank(x),na.last=if(na.rm)NA else TRUE) | |
186 | return(rank(x, na.last=if(na.rm) NA else TRUE)) | |
186 | 187 | |
187 | 188 | tab <- wtd.table(x, weights, normwt=normwt, na.rm=na.rm) |
188 | 189 |
46 | 46 | bsamsize \tab Sample size requirements for test of 2 proportions\cr |
47 | 47 | bystats \tab Statistics on a single variable by levels of >=1 factors\cr |
48 | 48 | bystats2 \tab 2-way statistics\cr |
49 | calltree \tab Calling tree of functions \cr | |
50 | \tab (David Lubinsky, \email{david@hoqax.att.com})\cr | |
51 | 49 | character.table \tab Shows numeric equivalents of all latin characters\cr |
52 | 50 | \tab Useful for putting many special chars. in graph titles\cr |
53 | 51 | \tab (Pierre Joyet, \email{pierre.joyet@bluewin.ch})\cr |
29 | 29 | } |
30 | 30 | \usage{ |
31 | 31 | contents(object, \dots) |
32 | \method{contents}{data.frame}(object, sortlevels=FALSE, \dots) | |
32 | \method{contents}{data.frame}(object, sortlevels=FALSE, id=NULL, | |
33 | range=NULL, values=NULL, \dots) | |
33 | 34 | \method{print}{contents.data.frame}(x, |
34 | sort=c('none','names','labels','NAs'), prlevels=TRUE, number=FALSE, \dots) | |
35 | sort=c('none','names','labels','NAs'), prlevels=TRUE, maxlevels=Inf, | |
36 | number=FALSE, \dots) | |
35 | 37 | \method{html}{contents.data.frame}(object, |
36 | sort=c('none','names','labels','NAs'), prlevels=TRUE, | |
38 | sort=c('none','names','labels','NAs'), prlevels=TRUE, maxlevels=Inf, | |
37 | 39 | file=paste('contents',object$dfname,'html',sep='.'), |
38 | 40 | levelType=c('list','table'), |
39 | 41 | append=FALSE, number=FALSE, nshow=TRUE, \dots) |
51 | 53 | variables use the same levels but in different orders. They will |
52 | 54 | still be recognized by the \code{html} method as having identical |
53 | 55 | levels if sorted.} |
56 | \item{id}{an optional subject ID variable name that if present in | |
57 | \code{object} will cause the number of unique IDs to be printed in | |
58 | the contents header} | |
59 | \item{range}{an optional variable name that if present in \code{object} | |
60 | will cause its range to be printed in the contents header} | |
61 | \item{values}{an optional variable name that if present in | |
62 | \code{object} will cause its unique values to be printed in the | |
63 | contents header} | |
54 | 64 | \item{x}{ |
55 | 65 | an object created by \code{contents} |
56 | 66 | } |
66 | 76 | \item{prlevels}{ |
67 | 77 | set to \code{FALSE} to not print all levels of \code{factor} variables |
68 | 78 | } |
79 | \item{maxlevels}{maximum number of levels to print for a \code{factor} variable} | |
69 | 80 | \item{number}{ |
70 | 81 | set to \code{TRUE} to have the \code{print} and \code{latex} methods |
71 | 82 | number the variables by their order in the data frame |
62 | 62 | m=NULL, probs=c(.5, .25, .75), nx=NULL, fill=TRUE, |
63 | 63 | idcol=NULL, freq=NULL, plotfreq=FALSE, |
64 | 64 | xlim=range(x), ylim=range(y), |
65 | xlab='x', ylab='y', \dots) | |
65 | xlab='x', ylab='y', colorfreq=FALSE, \dots) | |
66 | 66 | curveSmooth(x, y, id, p=NULL, pr=TRUE) |
67 | 67 | |
68 | 68 | } |
133 | 133 | Applies only to \code{method = "lattice"}. By default the largest bar |
134 | 134 | is 0.1 times the length of a panel's x-axis. Specify |
135 | 135 | \code{plotfreq = 0.5} for example to make the longest bar half this long.} |
136 | \item{colorfreq}{set to \code{TRUE} to color the frequencies printed by | |
137 | \code{plotfreq} using the colors provided by \code{idcol}.} | |
136 | 138 | \item{xlim, ylim, xlab, ylab}{plotting parameters. Default ranges are |
137 | 139 | the ranges in the entire set of raw data given to \code{curveRep}.} |
138 | 140 | \item{\dots}{arguments passed to other functions.} |
313 | 313 | justification for labels for column groups. Defaults to \code{"c"}. |
314 | 314 | } |
315 | 315 | \item{colheads}{a character vector of column headings if you don't want |
316 | to use \code{dimnames(object)[[2]]}. Specify \code{colheads=NULL} to | |
316 | to use \code{dimnames(object)[[2]]}. Specify \code{colheads=FALSE} to | |
317 | 317 | suppress column headings.} |
318 | 318 | \item{extracolheads}{ |
319 | 319 | an optional vector of extra column headings that will appear under the |
31 | 31 | } |
32 | 32 | \details{ |
33 | 33 | Uses the \code{mdbtools} package executables \code{mdb-tables}, |
34 | \code{mdb-schema}, and \code{mdb-export}. In Debian/Ubuntu Linux run | |
34 | \code{mdb-schema}, and \code{mdb-export} (with option \code{-b strip} | |
35 | to drop any binary output). In Debian/Ubuntu Linux run | |
35 | 36 | \code{apt get install mdbtools}. |
36 | 37 | \code{cleanup.import} is invoked by \code{csv.get} to transform |
37 | 38 | variables and store them as efficiently as possible. |
130 | 130 | |
131 | 131 | \method{latex}{summary.formula.reverse}(object, title = first.word(deparse(substitute(object))), digits, |
132 | 132 | prn = any(n != N), pctdig = 0, what=c('\%', 'proportion'), |
133 | npct = c("numerator", "both", "denominator", "none"), | |
133 | npct = c("numerator", "both", "denominator", "slash", "none"), | |
134 | 134 | npct.size = 'scriptsize', Nsize = "scriptsize", exclude1 = TRUE, |
135 | 135 | vnames=c("labels", "names"), prUnits = TRUE, middle.bold = FALSE, |
136 | 136 | outer.size = "scriptsize", caption, rowlabel = "", |
416 | 416 | specifies which counts are to be printed to the right of percentages. |
417 | 417 | The default is to print the frequency (numerator of the percent) in |
418 | 418 | parentheses. You can specify \code{"both"} to print both numerator and |
419 | denominator, \code{"denominator"}, or \code{"none"}. | |
419 | denominator, \code{"denominator"}, \code{"slash"} to | |
420 | typeset horizontally using a forward slash, or \code{"none"}. | |
420 | 421 | } |
421 | 422 | \item{npct.size}{ |
422 | 423 | the size for typesetting \code{npct} information which appears after percents. |
78 | 78 | file=paste(title, 'tex', sep='.'), append=FALSE, digits, |
79 | 79 | prn = any(n != N), what=c('proportion', '\%'), |
80 | 80 | pctdig = if(what == '\%') 0 else 2, |
81 | npct = c('numerator', 'both', 'denominator', 'none'), | |
81 | npct = c('numerator', 'both', 'denominator', 'slash', 'none'), | |
82 | 82 | npct.size = 'scriptsize', Nsize = 'scriptsize', exclude1 = TRUE, |
83 | 83 | vnames=c("labels", "names"), prUnits = TRUE, middle.bold = FALSE, |
84 | 84 | outer.size = "scriptsize", caption, rowlabel = "", |
237 | 237 | specifies which counts are to be printed to the right of percentages. |
238 | 238 | The default is to print the frequency (numerator of the percent) in |
239 | 239 | parentheses. You can specify \code{"both"} to print both numerator and |
240 | denominator, \code{"denominator"}, or \code{"none"}. | |
240 | denominator as a fraction, \code{"denominator"}, \code{"slash"} to | |
241 | typeset horizontally using a forward slash, or \code{"none"}. | |
241 | 242 | } |
242 | 243 | \item{npct.size}{ |
243 | 244 | the size for typesetting \code{npct} information which appears after |
162 | 162 | Gatz DF, Smith L (1995): The standard error of a weighted mean |
163 | 163 | concentration--II. Estimating confidence intervals. Atmospheric Env |
164 | 164 | 29:1195-1200. |
165 | ||
166 | http://en.wikipedia.org/wiki/Weighted_arithmetic_mean | |
165 | 167 | } |
166 | 168 | \seealso{ |
167 | 169 | \code{\link{mean}}, \code{\link{var}}, \code{\link{quantile}}, \code{\link{table}}, \code{\link{rank}}, \code{\link{loess.smooth}}, \code{\link{lowess}}, |
46 | 46 | <<echo=FALSE, results='asis'>>= |
47 | 47 | latex(summaryM(age + height + type ~ sex , data=dbase, overall=TRUE, test=TRUE), |
48 | 48 | size='small', where="ht", |
49 | long=TRUE, prmsd = TRUE, | |
49 | long=TRUE, prmsd = TRUE, npct='slash', | |
50 | 50 | caption="Descriptive Statistics", |
51 | 51 | msdsize='scriptsize', round = 2, digits=2, prtest='P', pdig =2, file='', |
52 | 52 | label="table:summary") |
64 | 64 | caption="Descriptive stats and tests of between-group differences for all primary and secondary neuroimaging outcomes", |
65 | 65 | label= "tbl:descrOutcomes", |
66 | 66 | exclude1=FALSE, digits=2, long=TRUE, prmsd=TRUE, |
67 | npct="both", size="tiny", | |
67 | npct="slash", size="tiny", npct.size='tiny', | |
68 | 68 | center="centering") |
69 | 69 | @ |
70 | ||
71 | Put a complex table in an external \texttt{.tex} file for conversion | |
72 | to \texttt{html} using \texttt{htlatex}: | |
73 | <<extex>>= | |
74 | ## Example taken from help file for summaryM | |
75 | options(digits=3) | |
76 | set.seed(173) | |
77 | sex <- factor(sample(c("m","f"), 500, rep=TRUE)) | |
78 | country <- factor(sample(c('US', 'Canada'), 500, rep=TRUE)) | |
79 | age <- rnorm(500, 50, 5) | |
80 | sbp <- rnorm(500, 120, 12) | |
81 | label(sbp) <- 'Systolic BP' | |
82 | units(sbp) <- 'mmHg' | |
83 | treatment <- factor(sample(c("Drug","Placebo"), 500, rep=TRUE)) | |
84 | treatment[1] | |
85 | sbp[1] <- NA | |
86 | ||
87 | # Generate a 3-choice variable; each of 3 variables has 5 possible levels | |
88 | symp <- c('Headache','Stomach Ache','Hangnail', | |
89 | 'Muscle Ache','Depressed') | |
90 | symptom1 <- sample(symp, 500,TRUE) | |
91 | symptom2 <- sample(symp, 500,TRUE) | |
92 | symptom3 <- sample(symp, 500,TRUE) | |
93 | Symptoms <- mChoice(symptom1, symptom2, symptom3, label='Primary Symptoms') | |
94 | table(as.character(Symptoms)) | |
95 | # Produce separate tables by country | |
96 | f <- summaryM(age + sex + sbp + Symptoms ~ treatment + country, | |
97 | groups='treatment', test=TRUE) | |
98 | fi <- '/tmp/z.tex' | |
99 | cat('\\documentclass{report}\\begin{document}\n', file=fi) | |
100 | w <- latex(f, file=fi, npct='slash', middle.bold=TRUE, prmsd=TRUE, append=TRUE) | |
101 | cat('\\end{document}\n', file=fi, append=TRUE) | |
102 | ## In /tmp run htlatex z.tex to produce z.html | |
103 | ## To get htlatex install the linux tex4ht package | |
104 | ## You may also need to install the tth package | |
105 | ## See http://biostat.mc.vanderbilt.edu/SweaveConvert | |
106 | @ | |
107 | ||
70 | 108 | \end{document} |