Skip to content

Instantly share code, notes, and snippets.

---
title: "Table Cross-Referencing"
output: bookdown::html_document2
---
## Using figures
Refer to table \@ref(fig:mytbl-1)
```{r mytbl-1, fig.cap="This is my table"}
@glin
glin / install-sf.sh
Last active May 10, 2022 14:39
Install sf from source on CentOS/RHEL 7
# Install sf from source on CentOS/RHEL 7. Tested with sf 0.9-6 on R 3.6.3.
yum update -y
# Pre-reqs: gcc, gcc-c++, make
yum install -y gcc gcc-c++ make
# Install EPEL 7
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
@glin
glin / cran-bioc-pkgs.R
Last active May 10, 2019 23:01
Get CRAN packages with Bioconductor dependencies
# Get a list of all CRAN packages with Bioc dependencies
cran_bioc_pkgs <- function(bioc_repo = "https://bioconductor.org/packages/3.8/bioc", recursive = TRUE) {
bioc_pkgs <- rownames(available.packages(repos = bioc_repo, filters = list()))
unique(unlist(tools::package_dependencies(bioc_pkgs, reverse = TRUE, recursive = recursive)))
}
# Set a CRAN repo if necessary
options(repos = "https://cloud.r-project.org")
pkgs <- sort(cran_bioc_pkgs())
@glin
glin / sysreqs_dl_last_month.csv
Last active July 18, 2019 23:11
SystemRequirements from CRAN with Downloads
Package Downloads SystemRequirements
stringi 484311 ICU4C (>= 52, optional)
knitr 458342 Package vignettes based on R Markdown v2 or reStructuredText require Pandoc (http://pandoc.org). The function rst2pdf() require rst2pdf (https://github.com/rst2pdf/rst2pdf).
curl 419127 libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb).
rmarkdown 395870 pandoc (>= 1.12.3) - http://pandoc.org
openssl 389541 OpenSSL >= 1.0.1
@glin
glin / trace-invalidation.R
Created January 30, 2018 07:04
trace-invalidation.R
library(shiny)
printCallStack <- function(calls = sys.calls()) {
shiny::printStackTrace(structure(list(), stack.trace = calls))
}
ui <- fluidPage(
textInput("txtA", "txtA"),
textInput("txtB", "txtB")
)
@glin
glin / dt-sort-selected-rows-server.R
Created September 14, 2017 19:36
Sort selected rows in DT server-side
# Sort selected rows in DT server-side
library(shiny)
library(DT)
ui <- fluidPage(
actionButton("sort", "Sort selected rows"),
DT::dataTableOutput("tbl")
)
@glin
glin / dt-sort-selected-rows.R
Created September 14, 2017 16:46
Sort selected rows in DT using a checkbox column
# Sort selected rows in DT using a checkbox column
# Live DOM ordering in DataTables
# https://datatables.net/plug-ins/sorting/#Custom-data-source-sorting
# https://datatables.net/examples/plug-ins/dom_sort.html
# Select extension already supports sorting on selected rows
# https://datatables.net/extensions/select/
# https://github.com/DataTables/Select/blob/24cc36565cca064118466bcffb9ce3037eaa9777/js/dataTables.select.js#L122-L132