Working on a PR for remotes
package (this PR), I looked into how download.file
methods evolved with R version, trying to understand how it works depending on the system or the url type.
Here is my understanding.
from R news
library(testthat) | |
library(lubridate) | |
base <- as.POSIXct("2009-08-03 12:01:59.23", tz = "UTC") | |
expect_floor_equal <- function(unit, time) { | |
unit <- rlang::enquo(unit) | |
time <- rlang::enquo(time) | |
as_time <- function(x) as.POSIXct(x, tz = "UTC") | |
rlang::expr(expect_equal(floor_date(base, rlang::UQE(unit)), as_time(rlang::UQE(time)))) |
#' From a stackoverflow question : https://stackoverflow.com/questions/46128164/extract-data-from-a-nested-list-with-loops#46128164 | |
nested_list_ex <- structure(list(scheduleList = structure(list( | |
schedule = structure(list( | |
score = structure(list( | |
class = structure(list(name = list("011c"), people = list("2"), teacher = structure(list(name = list("A")), .Names = "name", id = "D29")), .Names = c("name", "people", "teacher"), id = "011c", status = "-2"), | |
class = structure(list(name = list("013"), people = list("0"), teacher = structure(list(name = list("B")), .Names = "name", id = "D14")), .Names = c("name", "people", "teacher"), id = "602d", status = "-4"), | |
class = structure(list(name = list("603"), people = list("6"), teacher = structure(list(name = list("C")), .Names = "name", id = "D31")), .Names = c("name", "people", "teacher"), id = "603", status = "-4")), | |
.Names = c("class", "class", "class"), id = "1"), | |
score = structure(list( | |
class = structure(list(name = list |
# Read a pasword using a prompt | |
read_Password <- function(prompt) { | |
if (requireNamespace("rstudioapi")) { | |
pwd <- rstudioapi::askForPassword(prompt) | |
} else if (exists(".rs.askForPassword")) { | |
pwd <- .rs.askForPassword(prompt) | |
} else { | |
pwd <- readline(prompt) | |
} | |
return (pwd) |
h1{ | |
color: white; | |
padding: 10px; | |
background-color: #3399ff | |
} | |
ul { | |
list-style-type: square; | |
} |
snippet yaml_notebook_html
#' ---
#' title: "${1:title}"
#' author: "${2:author}"
#' knit: (function(inputFile, encoding) { rmarkdown::render(inputFile, encoding = encoding, output_file = sprintf("%s_%s.html", format(Sys.Date(), "%y%m%d"), basename(tools::file_path_sans_ext(inputFile))))})
`r paste("#' date: '\u0060r paste(\u0022", format(Sys.time(), "%d/%m/%Y")," - Dernière MAJ:\u0022, format(Sys.time(), \u0022%d/%m/%Y\u0022))\u0060'", sep = "")`
#' output :
#' html_document:
Simple R script that grabs the opened issues from a github repo :
$ github_issues hadley/dplyr
number user title labels
1 98 hadley Setup databases with travis enhancement
2 97 hadley Unique operator enhancement
3 96 hadley Implement right join and outer join enhancement
4 95 romainfrancois Hybrid evaluation enhancement, internal
5 94 hadley Make sure all vignettes work from R CMD check bug