Code Monkey home page Code Monkey logo

lazyweave's People

Contributors

nutterb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

lazyweave's Issues

Version 3.0.0 Features

Still to do.

Completed

  • change default for 'lazyReportFormat' to 'markdown'
  • Add option 'lazyWeave_cat = TRUE' This will cause output of table and figure generating functions to wrap the output in 'cat'
  • 'lazy.matrix' should print column names in bold text
  • Add pvalString as an exported function
  • Add 'cat=getOption(lazyWeave_cat)' argument to lazy.table, lazy.matrix, write.ctable, write.univ, lazy.figure
  • Configure lazy.table, lazy.matrix, write.ctable, write.univ, lazy.figure to act on the cat argument.
  • Remove pvalue.QHS
  • Replace functions calls to pvalue.QHS with pvalString

Reduce dependencies

The only purpose for the survival dependency is in the examples. With the addition of the Delivery data, this isn't necessary anymore. Adjustments to the examples would allow for removal of the survival dependency.

Unfortunately, the labeling functions in Hmisc are pretty essential to cattable and conttable. This dependency can't be avoided because not all of the labelling functions are exported in the Hmisc namespace. I'm contemplating copying those functions into lazyWeave so that Hmisc won't be a dependency any more. In my ideal world, I'd like to see the labeling functions have their own package, but this might require too many changes to Hmisc.

latexTranslate is the other function I rely on heavily, but this is exported in Hmisc's namespace, so we can at least access that one.

lazy.footnote could use some streamlining

lazy.footnote, for HTML files, requires the user to provide two tag names to generate the links between the footnote and the in-document reference. This could probably be simplified by having the user provide a tag name and appending it with [tag]_doc and [tag]_end.

`write.ctable` doesnt' play nicely with hooks for numbering and referencing tables

write.ctable doesnt' play nicely with hooks for numbering and referencing tables


title: "Auto-numbering and cross-referencing of figures and tables in rmarkdown"

output: html_document

# This is a knitr hook to enable figure and table captions
# number figures
# from http://stackoverflow.com/a/18672268/1036500
library("knitr")
tn = local({
  i = 0
  function(x) {
    i <<- i + 1
    paste("<table><caption>", 'Figure ', i, ': ', x, "</caption><colgroup><col width='100'></col></colgroup><thead><tr class='header'></tr></thead><tbody></tbody></table><p>", sep = '')
  }
})
knit_hooks$set(fig.cap = function(before, options, envir) {
  if(!before)
    tn(options$fig.cap)
})
default_output_hook = knit_hooks$get("output")
knit_hooks$set(output = function(x, options) {
  if (is.null(options$fig.cap) == F)  
    x
  else
    default_output_hook(x,options)
})

# number tables
# from http://stackoverflow.com/a/18672268/1036500
to = local({
  i = 0
  function(x) {
    i <<- i + 1
    paste("<table><caption>", 'Table ', i, ': ', x, "</caption><colgroup><col width='100'></col></colgroup><thead><tr class='header'></tr></thead><tbody></tbody></table><p>", sep = '')
  }
})
knit_hooks$set(tab.cap = function(before, options, envir) {
  if(!before)
    to(options$tab.cap)
})
default_output_hook = knit_hooks$get("output")
knit_hooks$set(output = function(x, options) {
  if (is.null(options$tab.cap) == F)  
    x
  else
    default_output_hook(x,options)
})
library(knitr)
library(kfigr) # devtools::install_github("github mkoohafkan/kfigr")
opts_chunk$set(message=FALSE, warning=FALSE)
library(lazyWeave)
library(stringr)
options(lazyReportFormat = "markdown")

summaries

Using the knitr option "echo=F" seems to cause the problem.

data(mtcars)

mtcars$group = sample(c("Bad", "Good"), size=nrow(mtcars), replace=T)

tab1 = catconttable(data = mtcars,
                    vars = c("mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"),
                    normal = c("mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"),
                    byVar = "group")
tab = write.ctable(tab1)
tab = str_split(tab, "\n")[[1]]
tab = tab[c(6,4,5,7:length(tab))]
tab = paste(tab, collapse="\n")
cat(tab)

See r figr("ATable", T,F) for summaries of the variables in the cars dataset.

data(mtcars)

mtcars$group = sample(c("Bad", "Good"), size=nrow(mtcars), replace=T)

tab1 = catconttable(data = mtcars,
                    vars = c("mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"),
                    normal = c("mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"),
                    byVar = "group")
tab = write.ctable(tab1)
tab = str_split(tab, "\n")[[1]]
tab = tab[c(6,4,5,7:length(tab))]
tab = paste(tab, collapse="\n")
cat(tab)

See r figr("ATable2", T,F) for summaries of the variables in the cars dataset.

remove text.size arguments

Currently, using the text.size argument produces a warning that the argument was scheduled for deletion in 2013. It's almost 2015. Maybe I should take this out finally.

lazy.build does a lot of file manipulation it doesn't need to

When building the zip folder for an HTML document, lazy.build copies everything into a top level directory. This is because I hadn't yet figured out how to avoid copying the whole directory tree into the file. I can avoid some of this overhead work by using the "-j" flag in the flags argument of zip

Use xtable to produce most tables?

The big question is if this will give me the same control over tables. Can I have columns spanning multiple cells? Can I control the HTML fonts? Can I add shading?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.