This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "RGL Example" | |
author: "John Muschelli" | |
date: "10/29/2018" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(dplyr) | |
library(tidyr) | |
url = "https://www.freeformatter.com/mime-types-list.html" | |
doc = read_html(url) | |
############################# | |
# Read in the table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(dplyr) | |
library(tidyr) | |
url = "https://www.freeformatter.com/mime-types-list.html" | |
doc = read_html(url) | |
############################# | |
# Read in the table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(dplyr) | |
library(tidyr) | |
url = "https://www.freeformatter.com/mime-types-list.html" | |
doc = read_html(url) | |
############################# | |
# Read in the table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = 1e5 | |
p = 500 | |
x = matrix(rnorm(n * p), | |
nrow = n, ncol = p) | |
z = rnorm(p) | |
xx = x | |
f1 = function() { | |
for (i in 1:nrow(x)) { | |
xx[i,] = x[i,] + z | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(reticulate) | |
library(AnalyzeFMRI) | |
library(neurobase) | |
sc <- reticulate::import("scipy") | |
np <- reticulate::import("numpy") | |
set.seed(1) | |
dims = rep(80, 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
man = list.files(path = "man", full.names = TRUE) | |
library(tools) | |
ll = lapply(man, function(x) { | |
o = tempfile(fileext = ".R") | |
tools::Rd2ex(x, out = o) | |
if (file.exists(o)) { | |
return(readLines(o)) | |
} | |
return("") | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(covr) | |
library(tidyr) | |
library(desc) | |
library(purrr) | |
library(devtools) | |
# get package name | |
desc = desc::desc(file = "DESCRIPTION") | |
package_name = desc$get("Package") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(didactr) | |
library(pdftools) | |
library(dplyr) | |
library(httr) | |
library(googledrive) | |
library(broom) | |
library(tidyr) | |
n_pdf_pages = function(file) { | |
if (length(file) == 0) { | |
return(NA) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Initial Question | |
From my understanding, there are three general ways to replace "library" statements in R packages: | |
1. List all packages on which our package relies in the "Imports" section of the DESCRIPTION file, and use the "@imports" statement in the NAMESPACE file to attach these packages to R. | |
2. List all packages on which our package relies in the "Imports" section of the DESCRIPTION file, and use package::function in our R code whenever we want to call a function from another package. For example, if we wanted to use the mutate() function from dplyr, we would write: dplyr::mutate(). | |
3. List all packages on which our package relies in the "Depends" section of the DESCRIPTION file. | |
## Answer | |
I combo option 1 and 2 and heavily suggest not using option 3: |