Skip to content
Browse files

reorganizing still

  • Loading branch information...
1 parent 29ab323 commit 3c66ff5190f9fdcb4f368567c697146db0f83e8b @cboettig committed Apr 11, 2013
View
108 R-tricks/citations.md
@@ -0,0 +1,108 @@
+
+
+
+
+This gives a quick example about how we can add citations into a markdown file with the same ease that we can in latex.
+I illustrate two different ways to get citation information. In the first example we look up the metadata automatically given
+the digital object identifier (doi) for the paper.
+
+In the second example we will read in a bibliography in bibtex format using the bibtex package, which can then be expressed in markdown immediately.
+
+Next I create an inline citation function that can take either a list of doi's or bibentry topics and format them into inline citations, while also storing this information to generate the full bibliography later.
+
+### DOI Approach
+
+The crossref function is available in the rplos package 0.0-6, (use the github copy, not in the CRAN version yet)
+
+
+```r
+require(rplos)
+```
+
+
+
+
+
+
+
+
+### Bibtex approach
+
+For convenience let's write the entry we pulled with crossref to a bibfile, just to get a simple bibfile as our starting point.
+
+
+```r
+library(bibtex)
+entry <- crossref("10.1111/j.1461-0248.2005.00827.x")
+write.bib(entry, file="example.bib")
+```
+
+
+
+
+We simply read in any bibtex file and print the citation:
+
+
+```
+Halpern BS, Regan HM, Possingham HP and McCarthy MA (2006). "Accounting
+for uncertainty in marine reserve design." _Ecology Letters_, *9*. ISSN
+1461-023X, <URL: http://dx.doi.org/10.1111/j.1461-0248.2005.00827.x>.
+```
+
+
+
+Now this would be much more awesome if we could generate keys on write.bib and use those bibtex keys, instead of the index value, `[[1]]`, to generate the citation.
+
+## Inline citations
+The other thing we need is a way to print inline citations that would just use a given shortened format (e.g. author-year, or a number) and add the citation to a `works_cited` object, which we could then use to generate the full citation information at the end.
+
+
+
+```r
+empty <- list()
+class(empty) <- "bibentry"
+options(works_cited = empty)
+pcite <- function(x){
+ sapply(x,function(x){
+ if(is(x, "character"))
+ entry <- crossref(x)
+ else # assume it's a bibentry object already
+ entry <- x
+ ## keep track of what we've cited so far
+ options(works_cited = c(getOption("works_cited"), entry))
+
+ ## And format the inline citation
+ n <- length(entry$author)
+ if(n==1)
+ sprintf("(%s, %s)", entry$author[[1]]$family, entry$year)
+ if(n==2)
+ sprintf("(%s & %s, %s)", entry$author[[1]]$family, entry$author[[2]]$family, entry$year)
+ else if(n>2)
+ sprintf("(%s _et. al._ %s)", entry$author[[1]]$family, entry$year)
+ })
+}
+```
+
+
+
+Note that the function can take a list of objects (though I'll have to clean up their formatting), and it can take either dois or the biblio list from above. It would be easy to write the textual citation formatting and number formatting too. I may add these to a simple R package for that purpose.
+
+Now we can gereate inline citations like this `(Halpern _et. al._ 2006)`. Hmm, looks like we need a way for `rinline` code to use `asis` formatting though.
+
+## Bibliography
+Then at the end of the document, use this command to print the bibliography generated by the use of our inline citations.
+
+
+```r
+getOption("works_cited")
+```
+
+Halpern B, Regan H, Possingham H and McCarthy M (2006). "Accounting for
+uncertainty in marine reserve design." _Ecology Letters_, *9*. ISSN
+1461-023X, <URL: http://dx.doi.org/10.1111/j.1461-0248.2005.00827.x>.
+
+
+
+
+
+
View
88 R-tricks/citations_knit_.md
@@ -0,0 +1,88 @@
+<!--roptions tidy=FALSE, warning=FALSE, comment=NA, message=FALSE-->
+<!--begin.rcode echo=FALSE
+#require(socialR)
+#render_wordpress()
+render_gfm()
+end.rcode-->
+
+This gives a quick example about how we can add citations into a markdown file with the same ease that we can in latex.
+I illustrate two different ways to get citation information. In the first example we look up the metadata automatically given
+the digital object identifier (doi) for the paper.
+
+In the second example we will read in a bibliography in bibtex format using the bibtex package, which can then be expressed in markdown immediately.
+
+Next I create an inline citation function that can take either a list of doi's or bibentry topics and format them into inline citations, while also storing this information to generate the full bibliography later.
+
+### DOI Approach
+
+The crossref function is available in the rplos package 0.0-6, (use the github copy, not in the CRAN version yet)
+<!--begin.rcode
+require(rplos)
+end.rcode-->
+
+<!--begin.rcode results="asis",
+ crossref("10.1111/j.1461-0248.2005.00827.x")
+end.rcode-->
+
+
+### Bibtex approach
+
+For convenience let's write the entry we pulled with crossref to a bibfile, just to get a simple bibfile as our starting point.
+<!--begin.rcode
+library(bibtex)
+entry <- crossref("10.1111/j.1461-0248.2005.00827.x")
+write.bib(entry, file="example.bib")
+end.rcode-->
+
+We simply read in any bibtex file and print the citation:
+<!--begin.rcode r bibex, results="asis", echo=FALSE
+biblio <- read.bib("example.bib")
+biblio[[1]]
+end.rcode-->
+Now this would be much more awesome if we could generate keys on write.bib and use those bibtex keys, instead of the index value, `[[1]]`, to generate the citation.
+
+## Inline citations
+The other thing we need is a way to print inline citations that would just use a given shortened format (e.g. author-year, or a number) and add the citation to a `works_cited` object, which we could then use to generate the full citation information at the end.
+
+<!--begin.rcode
+pcite <- function(x){
+ if(is.null(getOption("works_cited"))){
+ empty <- list()
+ class(empty) <- "bibentry"
+ options(works_cited = empty)
+ }
+ sapply(x,function(x){
+ if(is(x, "character"))
+ entry <- crossref(x)
+ else # assume it's a bibentry object already
+ entry <- x
+ ## keep track of what we've cited so far
+ options(works_cited = c(getOption("works_cited"), entry))
+
+ ## And format the inline citation
+ n <- length(entry$author)
+ if(n==1)
+ sprintf("(%s, %s)", entry$author[[1]]$family, entry$year)
+ if(n==2)
+ sprintf("(%s & %s, %s)", entry$author[[1]]$family, entry$author[[2]]$family, entry$year)
+ else if(n>2)
+ sprintf("(%s _et. al._ %s)", entry$author[[1]]$family, entry$year)
+ })
+}
+end.rcode-->
+Note that the function can take a list of objects (though I'll have to clean up their formatting), and it can take either dois or the biblio list from above. It would be easy to write the textual citation formatting and number formatting too. I may add these to a simple R package for that purpose.
+
+Now we can gereate inline citations like this <!--rinline pcite("10.1111/j.1461-0248.2005.00827.x")-->. Hmm, looks like we need a way for `rinline` code to use `asis` formatting though.
+
+## Bibliography
+Then at the end of the document, use this command to print the bibliography generated by the use of our inline citations.
+<!--begin.rcode results="asis"
+getOption("works_cited")
+end.rcode-->
+
+
+Like many others on this list, I finding myself more and more drawn to markdown rather then tex/Rnw as my standard format (not least of which is the ease of displaying the files on github, particularly now that we have automatic image uploading). One thing I miss from latex is the citation commands.
+
+I've taken a little whack at generating parenthetical citations
+
+
View
203 R-tricks/citing_r_packages.md
@@ -0,0 +1,203 @@
+
+
+
+[code lang='r']
+require(socialR)
+[/code]
+[code lang='r']
+Loading required package: socialR
+[/code]
+[code lang='r']
+render_wordpress()
+[/code]
+
+
+
+
+Many studies using R require additional packages, but citations to R often fail to cite the packages seperately, even when they mention the base R. R makes it rather easy to get the citation information for any package
+[code lang='r']
+citation("ouch")
+[/code]
+[code lang='r']
+
+To cite the ouch package in publications
+use:
+
+ Aaron A. King and Marguerite A. Butler
+ (2009), ouch: Ornstein-Uhlenbeck models
+ for phylogenetic comparative hypotheses (R
+ package),
+ http://ouch.r-forge.r-project.org
+
+ Butler, M. A. and King, A. A. (2004)
+ Phylogenetic comparative analysis: a
+ modeling approach for adaptive evolution
+ Am. Nat. 164:683--695
+
+As ouch is continually evolving, you may
+want to cite its version number. Find it
+with 'help(package=ouch)'.
+
+[/code]
+
+
+
+Can I have that in bibtex format please?
+[code lang='r']
+toBibtex(citation("ouch"))
+[/code]
+[code lang='r']
+@Manual{,
+ title = {ouch: Ornstein-Uhlenbeck models for phylogenetic comparative hypotheses},
+ author = {Aaron A. King and Marguerite A. Butler},
+ year = {2009},
+ url = {http://ouch.r-forge.r-project.org},
+}
+
+@Article{,
+ author = {Marguerite A. Butler and Aaron A. King},
+ title = {Phylogenetic comparative analysis: a modeling approach for adaptive evolution},
+ journal = {American Naturalist},
+ year = {2004},
+ volume = {164},
+ pages = {683--695},
+ url = {http://www.journals.uchicago.edu/AN/journal/issues/v164n6/40201/40201.html},
+}
+[/code]
+
+
+
+Notice that this package provides the citation information for both the package and the associated journal article simultaneously, and R has successfully identified the formats as 'Manual' and 'Article' respectively.
+
+
+After running your code, consider creating a custom bibtex file containing the citation information for all the packages you have just used. (The file can abe imported into most citation managers, if LaTeX isn't your thing).
+[code lang='r']
+sink("test.bib")
+out <- sapply(names(sessionInfo()$otherPkgs),
+ function(x) print(citation(x), style = "Bibtex"))
+[/code]
+[code lang='r']
+@Manual{,
+ title = {socialR: Social functions for R},
+ author = {Carl Boettiger},
+ year = {2010},
+ note = {R package version 0.0-1},
+}
+@Manual{,
+ title = {knitr: A general-purpose package for dynamic report
+generation in R},
+ author = {Yihui Xie},
+ year = {2012},
+ note = {R package version 0.3.2},
+ url = {http://yihui.name/knitr/},
+}
+[/code]
+[code lang='r']
+sink()
+[/code]
+
+
+
+A list of the loaded packages in LaTeX format can be loaded using
+[code lang='r']
+toLatex(sessionInfo(), locale = FALSE)
+[/code]
+[code lang='r']
+\begin{itemize}\raggedright
+ \item R version 2.14.2 (2012-02-29), \verb|x86_64-pc-linux-gnu|
+ \item Base packages: base, datasets,
+ grDevices, graphics, stats, utils
+ \item Other packages: knitr~0.3.2,
+ socialR~0.0-1
+ \item Loaded via a namespace (and not
+ attached): RCurl~1.91-1,
+ RWordPress~0.2-1, Rcpp~0.9.10,
+ Rflickr~0.2-1, XML~3.9-4, XMLRPC~0.2-5,
+ codetools~0.2-8, digest~0.5.1,
+ evaluate~0.4.1, formatR~0.3-4,
+ highlight~0.3.1, methods~2.14.2,
+ parser~0.0-14, plyr~1.7.1, stringr~0.6,
+ tools~2.14.2
+\end{itemize}
+[/code]
+
+
+
+
+### For package authors
+R will attempt to automatically construct the citation information for the package automatically from the description file, so it is not strictly necessary to do anything to your package to create it. Note that R has recently adopted a new syntax to specify the authors, which is a bit more precise. Instead of `Authors:` in the description, use `Authors@R:` followed by R code such as
+[code lang='r']
+c(person("Carl", "Boettiger",
+ role = c("aut", "cre"), email = "cboettig@gmail.com"),
+ person("Duncan", "Temple Lang", role = "aut"))
+[/code]
+[code lang='r']
+[1] "Carl Boettiger <cboettig@gmail.com> [aut, cre]"
+[2] "Duncan Temple Lang [aut]"
+[/code]
+
+
+This defines the roles (author, creator, etc, see `?person` for details), and 'creator' takes the place of the `Maintainer:` designation, and requires an email address. If you wish to add an additional publication as part of the citation information (such as the example from `ouch` above,
+you can specify this in the CITATION file. For the example this looks like:
+[code lang='r']
+citHeader("To cite the ouch package in publications use:")
+[/code]
+[code lang='r']
+[1] "To cite the ouch package in publications use:"
+attr(,"class")
+[1] "citationHeader"
+[/code]
+[code lang='r']
+
+citEntry(entry = "Manual",
+ title = "ouch: Ornstein-Uhlenbeck models for phylogenetic comparative hypotheses",
+ author = personList(as.person("Aaron A. King"),
+ as.person("Marguerite A. Butler")),
+ year = 2009, url = "http://ouch.r-forge.r-project.org",
+ textVersion = paste("Aaron A. King and Marguerite A. Butler (2009),",
+ "ouch: Ornstein-Uhlenbeck models for phylogenetic comparative hypotheses (R package),",
+ "http://ouch.r-forge.r-project.org"))
+[/code]
+[code lang='r']
+King AA and Butler MA (2009). _ouch: Ornstein-Uhlenbeck models for
+phylogenetic comparative hypotheses_. <URL:
+http://ouch.r-forge.r-project.org>.
+[/code]
+[code lang='r']
+
+citEntry(entry = "Article",
+ author = personList(as.person("Marguerite A. Butler"),
+ as.person("Aaron A. King")), title = "Phylogenetic comparative analysis: a modeling approach for adaptive evolution",
+ journal = "American Naturalist", year = 2004,
+ volume = 164, pages = "683--695",
+ url = "http://www.journals.uchicago.edu/AN/journal/issues/v164n6/40201/40201.html",
+ textVersion = paste("Butler, M. A. and King, A. A. (2004)",
+ "Phylogenetic comparative analysis: a modeling approach for adaptive evolution",
+ "Am. Nat. 164:683--695"))
+[/code]
+[code lang='r']
+Butler MA and King AA (2004). "Phylogenetic comparative analysis: a
+modeling approach for adaptive evolution." _American Naturalist_,
+*164*, pp. 683-695. <URL:
+http://www.journals.uchicago.edu/AN/journal/issues/v164n6/40201/40201.html>.
+[/code]
+[code lang='r']
+citFooter("As ouch is continually evolving, you may want to cite its version number. Find it with 'help(package=ouch)'.")
+[/code]
+[code lang='r']
+[1] "As ouch is continually evolving, you may want to cite its version number. Find it with 'help(package=ouch)'."
+attr(,"class")
+[1] "citationFooter"
+[/code]
+
+
+
+(It seems like there should be a simple way to generate this automatically from the bibtex format, but I haven't discovered it.)
+
+### R as a citation tool
+ * OAI-Harvester
+ * Crossref API -- format as an R bibentry
+
+ * knitr citations: identify dois and pull citation info. Or run through bibtex and convert to html?
+
+
View
93 R-tricks/citing_r_packages_knit_.md
@@ -0,0 +1,93 @@
+<!--roptions comment=NA-->
+
+
+<!--begin.rcode setup
+require(socialR)
+render_wordpress()
+end.rcode-->
+
+
+Many studies using R require additional packages, but citations to R often fail to cite the packages seperately, even when they mention the base R. R makes it rather easy to get the citation information for any package
+<!--begin.rcode
+citation("ouch")
+end.rcode-->
+
+Can I have that in bibtex format please?
+<!--begin.rcode
+toBibtex(citation("ouch"))
+end.rcode-->
+
+Notice that this package provides the citation information for both the package and the associated journal article simultaneously, and R has successfully identified the formats as 'Manual' and 'Article' respectively.
+
+
+After running your code, consider creating a custom bibtex file containing the citation information for all the packages you have just used. (The file can abe imported into most citation managers, if LaTeX isn't your thing).
+<!--begin.rcode
+sink("test.bib")
+out <- sapply(names(sessionInfo()$otherPkgs), function(x) print(citation(x), style="Bibtex"))
+sink()
+end.rcode-->
+
+A list of the loaded packages in LaTeX format can be loaded using
+<!--begin.rcode
+ toLatex(sessionInfo(), locale=FALSE)
+end.rcode-->
+
+
+### For package authors
+R will attempt to automatically construct the citation information for the package automatically from the description file, so it is not strictly necessary to do anything to your package to create it. Note that R has recently adopted a new syntax to specify the authors, which is a bit more precise. Instead of `Authors:` in the description, use `Authors@R:` followed by R code such as
+<!--begin.rcode
+c(person("Carl", "Boettiger", role = c("aut", "cre"),
+ email = "cboettig@gmail.com"),
+ person("Duncan", "Temple Lang", role = "aut"))
+end.rcode-->
+This defines the roles (author, creator, etc, see `?person` for details), and 'creator' takes the place of the `Maintainer:` designation, and requires an email address. If you wish to add an additional publication as part of the citation information (such as the example from `ouch` above,
+you can specify this in the CITATION file. For the example this looks like:
+<!--begin.rcode
+citHeader("To cite the ouch package in publications use:")
+
+citEntry(
+ entry="Manual",
+ title="ouch: Ornstein-Uhlenbeck models for phylogenetic comparative hypotheses",
+ author=personList(
+ as.person("Aaron A. King"),
+ as.person("Marguerite A. Butler")
+ ),
+ year=2009,
+ url="http://ouch.r-forge.r-project.org",
+ textVersion=paste(
+ "Aaron A. King and Marguerite A. Butler (2009),",
+ "ouch: Ornstein-Uhlenbeck models for phylogenetic comparative hypotheses (R package),",
+ "http://ouch.r-forge.r-project.org"
+ )
+ )
+
+citEntry(
+ entry="Article",
+ author=personList(
+ as.person("Marguerite A. Butler"),
+ as.person("Aaron A. King")
+ ),
+ title="Phylogenetic comparative analysis: a modeling approach for adaptive evolution",
+ journal="American Naturalist",
+ year=2004,
+ volume=164,
+ pages="683--695",
+ url="http://www.journals.uchicago.edu/AN/journal/issues/v164n6/40201/40201.html",
+ textVersion=paste(
+ "Butler, M. A. and King, A. A. (2004)",
+ "Phylogenetic comparative analysis: a modeling approach for adaptive evolution",
+ "Am. Nat. 164:683--695"
+ )
+ )
+citFooter("As ouch is continually evolving, you may want to cite its version number. Find it with 'help(package=ouch)'.")
+end.rcode-->
+
+(It seems like there should be a simple way to generate this automatically from the bibtex format, but I haven't discovered it.)
+
+### R as a citation tool
+ * OAI-Harvester
+ * Crossref API -- format as an R bibentry
+
+ * knitr citations: identify dois and pull citation info. Or run through bibtex and convert to html?
+
+
View
45 R-tricks/conf_twitter_summary.Rmd
@@ -0,0 +1,45 @@
+---
+layout: post
+title: Tracking my ESA2012 experience through twitter
+
+---
+
+
+
+
+``` {r }
+library(twitteR)
+hashtag <- "#ESA2012"
+user <- "cboettig"
+````
+
+User's conference tweets
+
+``` {r }
+tweets <- twListToDF(userTimeline(user, n=500))
+tagged <- grep(hashtag, tweets$text, ignore.case=TRUE)
+````
+
+Write to file, making links appear as links
+
+``` {r comment=NA, results="asis"}
+text <- tweets$text[tagged]
+text <- gsub("(@[A-Za-z0-9_]+)", "<a href=\"http://twitter.com/\\1\">\\1</a>", text)
+text
+````
+
+Mentions at conference, (other than retweets)
+
+``` {r }
+mentions <- twListToDF(searchTwitter(paste("@", user, sep=""), n=300))
+with_hashtag <- grep(hashtag, mentions$text, ignore.case=TRUE)
+rt <- grep("RT\\s", mentions$text)
+me_not_rt <- with_hashtag[!(with_hashtag %in% rt)]
+````
+
+Again, write the output
+
+``` {r results="asis"}
+text2 <- mentions$text[me_not_rt]
+text2 <- gsub("(@[A-Za-z0-9_]+)", "<a href=\"http://twitter.com/\\1\">\\1</a>", text2)
+text2
View
0 math.Rmd → R-tricks/math.Rmd
File renamed without changes.
View
19 R-tricks/pandoc_latex_table.Rmd
@@ -0,0 +1,19 @@
+
+We can use xtable to produce latex table formatted in the output.
+```{r results="asis"}
+library(xtable)
+ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
+trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
+group <- gl(2,10,20, labels=c("Ctl","Trt"))
+weight <- c(ctl, trt)
+mytable <- summary(lm(weight ~ group))
+xtable(mytable)
+```
+
+Though the output is markdown, pandoc can regonize the resulting latex block, and render the table.
+Unfortunately, pandoc doesn't like the math markup that comes out in this data table title.
+Consequently,
+
+ pandoc -S pandoc_latex_tables.md -o pandoc_latex.pdf
+
+fails. Deleting the math markup in the table title fixes this.
View
36 R-tricks/pandoc_latex_table.md
@@ -0,0 +1,36 @@
+
+We can use xtable to produce latex table formatted in the output.
+
+```r
+library(xtable)
+ctl <- c(4.17, 5.58, 5.18, 6.11, 4.5, 4.61, 5.17, 4.53, 5.33, 5.14)
+trt <- c(4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 6.03, 4.89, 4.32, 4.69)
+group <- gl(2, 10, 20, labels = c("Ctl", "Trt"))
+weight <- c(ctl, trt)
+mytable <- summary(lm(weight ~ group))
+xtable(mytable)
+```
+
+% latex table generated in R 2.15.3 by xtable 1.7-0 package
+% Mon Mar 18 15:33:52 2013
+\begin{table}[ht]
+\begin{center}
+\begin{tabular}{rrrrr}
+ \hline
+ & Estimate & Std. Error & t value & Pr($>$$|$t$|$) \\
+ \hline
+(Intercept) & 5.0320 & 0.2202 & 22.85 & 0.0000 \\
+ groupTrt & -0.3710 & 0.3114 & -1.19 & 0.2490 \\
+ \hline
+\end{tabular}
+\end{center}
+\end{table}
+
+
+Though the output is markdown, pandoc can regonize the resulting latex block, and render the table.
+Unfortunately, pandoc doesn't like the math markup that comes out in this data table title.
+Consequently,
+
+ pandoc -S pandoc_latex_tables.md -o pandoc_latex.pdf
+
+fails. Deleting the math markup in the table title fixes this.
View
48 R-tricks/pandoc_latex_tables.md
@@ -0,0 +1,48 @@
+
+
+```r
+render_gfm()
+```
+
+
+
+
+We can use xtable to produce latex table formatted in the output.
+
+
+```r
+library(xtable)
+ctl <- c(4.17, 5.58, 5.18, 6.11, 4.5, 4.61, 5.17,
+ 4.53, 5.33, 5.14)
+trt <- c(4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 6.03,
+ 4.89, 4.32, 4.69)
+group <- gl(2, 10, 20, labels = c("Ctl", "Trt"))
+weight <- c(ctl, trt)
+mytable <- summary(lm(weight ~ group))
+xtable(mytable)
+```
+
+% latex table generated in R 2.14.2 by xtable 1.7-0 package
+% Fri Mar 30 17:22:44 2012
+\begin{table}[ht]
+\begin{center}
+\begin{tabular}{rrrrr}
+ \hline
+ & Estimate & Std. Error & t value & Pr($>$$|$t$|$) \\
+ \hline
+(Intercept) & 5.0320 & 0.2202 & 22.85 & 0.0000 \\
+ groupTrt & -0.3710 & 0.3114 & -1.19 & 0.2490 \\
+ \hline
+\end{tabular}
+\end{center}
+\end{table}
+
+
+
+Though the output is markdown, pandoc can regonize the resulting latex block, and render the table.
+Unfortunately, pandoc doesn't like the math markup that comes out in this data table title.
+Consequently,
+
+ pandoc -S pandoc_latex_tables.md -o pandoc_latex.pdf
+
+fails. Deleting the math markup in the table title fixes this.
View
22 R-tricks/pandoc_latex_tables_knit_.md
@@ -0,0 +1,22 @@
+<!--begin.rcode
+render_gfm()
+end.rcode-->
+
+We can use xtable to produce latex table formatted in the output.
+<!--begin.rcode results="asis"
+library(xtable)
+ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
+trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
+group <- gl(2,10,20, labels=c("Ctl","Trt"))
+weight <- c(ctl, trt)
+mytable <- summary(lm(weight ~ group))
+xtable(mytable)
+end.rcode-->
+
+Though the output is markdown, pandoc can regonize the resulting latex block, and render the table.
+Unfortunately, pandoc doesn't like the math markup that comes out in this data table title.
+Consequently,
+
+ pandoc -S pandoc_latex_tables.md -o pandoc_latex.pdf
+
+fails. Deleting the math markup in the table title fixes this.
View
0 transparent_ggplot_Q.Rmd → R-tricks/transparent_ggplot_Q.Rmd
File renamed without changes.
View
0 bash_scripts/bibgen → bash-scripts/bibgen
File renamed without changes.
View
0 bash_scripts/commits.rb → bash-scripts/commits.rb
File renamed without changes.
View
0 fix-citations.sh → bash-scripts/fix-citations.sh
File renamed without changes.
View
0 bash_scripts/git-latexdiff.sh → bash-scripts/git-latexdiff.sh
File renamed without changes.
View
0 bash_scripts/knitcite → bash-scripts/knitcite
File renamed without changes.
View
0 bash_scripts/knitscript → bash-scripts/knitscript
File renamed without changes.
View
0 bash_scripts/rstudio_one → bash-scripts/rstudio_one
File renamed without changes.
View
0 bash_scripts/uploadflickr → bash-scripts/uploadflickr
File renamed without changes.
View
5 render_gfm.rb
@@ -1,5 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'octokit'
-puts Octokit.markdown(File.read(ARGV.first))
-#File.open("test.html", "w"){ |f| f.write(out) }
View
0 issues.rb → ruby-scripts/issues.rb
File renamed without changes.
View
24 template_knit_.md
@@ -1,24 +0,0 @@
-<!--roptions dev="png", fig.width=7, fig.height=5, tidy=FALSE, warning=FALSE, comment=NA, message=FALSE-->
-
-## Template title
-
-A template file for creating and sharing reproducible code bits in sandbox.
-
-<!--begin.rcode echo=FALSE
-render_gfm()
-opts_knit$set(upload = TRUE)
-## use my flickr account for images
-require(socialR)
-opts_knit$set(upload.fun = flickr.url)
-end.rcode-->
-
-
-
-
-## endmatter
- * Author: Carl Boettiger <cboettig@gmail.com>
- * License: CC0
-
-This is a reproducible example, the code above has been run to generate the results displayed.
-This scratch-pad is brought to you thanks to [knitr](https://github.com/yihui/knitr) with markdown support
-and Github. Use the links from the commit history for a version-stable handle, or use the base path for the most recent copy.
View
6 tst.awk
@@ -1,6 +0,0 @@
-(state == 0) && /^---$/ { state=1; print; next }
-(state == 1) && /^---$/ { state=2; next }
-(state == 2) && /^./ { state=3; printf "title: %s\n---\n",$0; next }
-(state == 3) && /^-+$/ { state=4; next }
-
-state != 2 { print }

0 comments on commit 3c66ff5

Please sign in to comment.
Something went wrong with that request. Please try again.