code
stringlengths 1
13.8M
|
---|
dsmoothlm <- function(y,
d = c(1, 2),
pmin = c(0, 1, 2, 3, 4, 5),
pmax = c(0, 1, 2, 3, 4, 5),
qmin = c(0, 1, 2, 3, 4, 5),
qmax = c(0, 1, 2, 3, 4, 5),
mu = c(0, 1, 2, 3),
mu.p = c(0, 1, 2, 3),
pp = c(1, 3),
bStart.p = 0.15,
InfR.p = c("Opt", "Nai", "Var")) {
if (length(y) <= 1 || !all(!is.na(y)) || !is.numeric(y)) {
stop("The argument 'y' must be a numeric vector with length > 1 and ",
"without NAs.")
}
if (!(length(d) %in% c(1, 2)) || !all(!is.na(d)) || !is.numeric(d)) {
stop("The argument 'd' must be a single integer value (1 or 2).")
}
d <- floor(d)
if (!(length(mu) %in% c(1, 4)) || !all(!is.na(mu)) || !is.numeric(mu)) {
stop("The argument 'mu' must be a single integer value (0, 1, 2 or 3).")
}
mu <- floor(mu)
if (!(length(mu.p) %in% c(1, 4)) || !all(!is.na(mu.p)) || !is.numeric(mu.p)) {
stop("The argument 'mu' must be a single integer value (0, 1, 2 or 3).")
}
mu.p <- floor(mu.p)
if (!(length(pp) %in% c(1, 2)) || !all(!is.na(pp)) || !is.numeric(pp)) {
stop("The argument 'pp' must be a single integer value (either 1 or 3).")
}
pp <- floor(pp)
if (length(InfR.p) != 1 || !(InfR.p %in% c("Opt", "Nai", "Var"))) {
stop("Input of argument 'InfR.p' incorrect. Input not recognized.")
}
if (length(bStart.p) != 1 || is.na(bStart.p) || !is.numeric(bStart.p) ||
(bStart.p <= 0)) {
stop("The argument 'bStart.p' must be a single non-NA double value with ",
"bStart.p > 0.")
}
if (all(d == c(1, 2))) d <- 1
if (all(mu == c(0, 1, 2, 3))) mu <- 1
if (all(mu.p == c(0, 1, 2, 3))) mu.p <- 1
if (all(pp == c(1, 3))) pp <- 1
if (all(pmin == c(0, 1, 2, 3, 4, 5))) pmin <- 0
if (all(pmax == c(0, 1, 2, 3, 4, 5))) pmax <- 0
if (all(qmin == c(0, 1, 2, 3, 4, 5))) qmin <- 0
if (all(qmax == c(0, 1, 2, 3, 4, 5))) pmax <- 0
if (all(InfR.p == c("Opt", "Nai", "Var"))) InfR.p <- "Opt"
if (!(d %in% c(1, 2))) {
stop("Input of argument 'd' incorrect. It must be set to either 1 or 2.")
}
if (!length(pmin) %in% c(1, 5) || !all(!is.na(pmin)) || !is.numeric(pmin)) {
stop("The argument 'pmin' must be a single integer value (1, 2, 3, 4 or 5).")
}
pmin <- floor(pmin)
if (!length(pmax) %in% c(1, 5) || !all(!is.na(pmax)) || !is.numeric(pmax)) {
stop("The argument 'pmax' must be a single integer value (1, 2, 3, 4 or 5).")
}
pmax <- floor(pmax)
if (!length(qmin) %in% c(1, 5) || !all(!is.na(qmin)) || !is.numeric(qmin)) {
stop("The argument 'pmin' must be a single integer value (1, 2, 3, 4 or 5).")
}
qmin <- floor(qmin)
if (!length(qmax) %in% c(1, 5) || !all(!is.na(qmax)) || !is.numeric(qmax)) {
stop("The argument 'pmin' must be a single integer value (1, 2, 3, 4 or 5).")
}
qmax <- floor(qmax)
if (!(pp %in% c(1, 3))) {
stop("Input of argument 'pp' incorrect. It must be set to either 1 or 3.")
}
result.p <- tsmoothlmCalc(y, qmin = qmin, qmax = qmax, pmin = pmin,
pmax = pmax, p = pp, mu = mu.p, InfR = InfR.p,
bStart.p, bb = 1, method = "lpr")
cf0 <- result.p$cf0
d.BIC <- result.p$d.BIC
p.BIC <- result.p$p.BIC
q.BIC <- result.p$q.BIC
bStart <- result.p$b0
bb <- 1
if (d == 1) {InfR <- "Nai"} else {InfR <- "Var"}
cb <- 0.05
n <- length(y)
p <- d + 1
k <- p + 1
pd <- p + 2
runc <- 1
n1 <- trunc(n * cb)
m <- 1000000
u <- (-m:m) / (m + 0.5)
Vc <- 2 * gamma(1 - 2 * d.BIC) * sin(pi * d.BIC)
wkp <- lookup$lookup_3kerns[(mu + 1), d][[1]](u)
Rp <- Vc * lookup$lookup_3kerns_kdf[(mu + 1), d][[1]](d.BIC)
mukp <- sum((u ** k) * wkp) / m
c1 <- factorial(k) ** 2 * (2 * d + 1) / (2 * (k - d))
c2 <- (1 - 2 * cb) * (1 - 2 * d.BIC) * Rp / (mukp) ** 2
steps <- rep(NA, 40)
bd2_func <- lookup$InfR2_lookup[d, InfR][[1]]
noi <- 40
for (i in 1:noi) {
if (runc == 1) {
if (i > 1) {bold1 <- bold}
if (i == 1) {
bold <- bStart ; bd <- bStart
} else {
bold <- bopt ; bd <- bd2_func(bold, d.BIC)
}
if (bd >= 0.49) {bd <- 0.49}
yed <- smoots::gsmooth(y, k, pd, mu, bd, bb)$ye
I2 <- sum(yed[max(1, n1):((1 - cb) * n)]^2) / (n - 2 * n1)
c3 <- cf0 / I2
if (d == 1) {
bopt <- (c1 * c2 * c3) ** (1 / (7 - 2 * d.BIC)) * n ** ((2 * d.BIC - 1)
/ (7 - 2 * d.BIC))
if (bopt < n ** (-7 / 9)) {bopt <- n ** (-7 / 9)}
}
if (d == 2) {
bopt <- (c1 * c2 * c3) ** (1 / (9 - 2 * d.BIC)) * n ** ((2 * d.BIC - 1)
/ (9 - 2 * d.BIC))
if (bopt < n ** (-9 / 11)) {bopt <- n ** (-9 / 11)}
}
if (bopt > 0.49) {bopt <- 0.49}
steps[i] <- bopt
if (i > 2 && abs(bold - bopt) / bopt < 1 / n) {runc <- 0}
if (i > 3 && abs(bold1 - bopt) / bopt < 1 / n){
bopt <- (bold + bopt) / 2
runc <- 0
}
}
}
if (d == 1 && bopt < n ** (-7 / 9)) {bopt <- n ** (-7 / 9)}
if (d == 2 && bopt < n ** (-9 / 11)) {bopt <- n ** (-9 / 11)}
if (bopt > 0.49) {bopt <- 0.49}
est.opt <- smoots::gsmooth(y, d, p, mu, bopt, bb)
ye <- est.opt$ye
ws <- est.opt$ws
results <- list(ye = ye, b0 = bopt, cf0 = cf0, p.BIC = p.BIC, q.BIC = q.BIC,
d.BIC = d.BIC, v = d, n = n, niterations = length(steps[!is.na(steps)]),
orig = y, iterations = steps[!is.na(steps)], pp = pp,
mu.p = mu.p, InfR.p = InfR.p, bStart = bStart, bb = bb, cb = cb,
ws = ws, p = d + 1)
class(results) <- "esemifar"
attr(results, "function") <- "dsmoothlm"
drop(results)
} |
obj = RestRserve:::ContentHandlersFactory$new()
cl = RestRserve:::ContentHandlersFactory$new()
expect_true(inherits(obj, "ContentHandlers"))
expect_true(inherits(obj$handlers, "environment"))
expect_equal(length(obj$handlers), 6L)
expect_true(inherits(obj$handlers[["text/plain"]], "list"))
expect_equal(length(obj$handlers[["text/plain"]]), 2L)
expect_equal(names(obj$handlers[["text/plain"]]), c("encode", "decode"))
expect_true(inherits(obj$handlers[["text/plain"]]$encode, "function"))
expect_true(inherits(obj$handlers[["text/plain"]]$decode, "function"))
expect_true(inherits(obj$list(), "list"))
expect_equal(sort(names(obj$list())), sort(c("application/json", "text/plain", "text/html", "text/css",
"application/javascript", "image/png")))
e = tryCatch(obj$get_decode("unknown"), error = function(e) e)
expect_error(obj$get_decode("unknown"))
expect_true(inherits(e, "HTTPErrorRaise"))
expect_error(obj$get_encode("unknown"))
f = function() TRUE
ct = "custom/type1"
obj$set_decode(ct, f)
expect_true(ct %in% names(obj$handlers))
expect_equal(obj$get_decode(ct), f)
expect_equal(obj$handlers[[ct]][["decode"]], f)
expect_null(obj$handlers[[ct]][["encode"]])
f = function() FALSE
ct = "custom/type2"
obj$set_encode(ct, f)
expect_true(ct %in% names(obj$handlers))
expect_equal(obj$get_encode(ct), f)
expect_equal(obj$handlers[[ct]][["encode"]], f)
expect_null(obj$handlers[[ct]][["decode"]])
f = function() NULL
ct = "custom/type3"
obj$set_encode(ct, f)
obj$set_decode(ct, f)
expect_true(ct %in% names(obj$handlers))
expect_equal(obj$get_encode(ct), f)
expect_equal(obj$get_decode(ct), f)
expect_equal(obj$handlers[[ct]][["encode"]], f)
expect_equal(obj$handlers[[ct]][["decode"]], f)
decoder = obj$get_decode("application/json")
body = charToRaw("{\"param\":\"value\"}")
expect_equal(decoder(body), list("param" = "value"))
expect_error(decoder(rawToChar("1 = 1")))
decoder = obj$get_decode("application/json; charset=utf-8")
body = charToRaw("{\"param\":\"value\"}")
expect_equal(decoder(body), list("param" = "value"))
expect_error(decoder(rawToChar("1 = 1")))
for (ct in c("application/json; charset=utf-8", "APPlication/JSON; charset=utf-8")) {
encoder = obj$get_encode(ct)
expect_equal(encoder(list(param = 'value')), "{\"param\":\"value\"}")
}
for (ct in c("text/plain; charset=utf-8", "TEXT/plain; charset=latin1")) {
encoder = obj$get_encode(ct)
expect_equal(encoder(list(param = 'value')), "value")
}
decoder = obj$get_decode("text/plain")
b = "Test!!!"
expect_equal(decoder(b), b)
expect_equal(decoder(charToRaw(b)), b)
expect_error(obj$get_decode(c("application/json", "text/plain")))
expect_error(obj$get_decode(1))
expect_error(obj$get_decode(c(1, 2)))
expect_error(obj$set_decode("application/json", list()))
expect_error(obj$set_decode(1, identity))
expect_error(obj$get_encode(c("application/json", "text/plain")))
expect_error(obj$get_encode(1))
expect_error(obj$get_encode(c(1, 2)))
expect_error(obj$set_encode("application/json", list()))
expect_error(obj$set_encode(1, identity))
expect_error(obj$get_decode('application/json10'))
err = try(obj$get_decode('application/json10'), silent = TRUE)
expect_equal(attr(err, 'condition')$response$status_code, 415L)
err = try(obj$get_encode(25), silent = TRUE)
expect_equal(attr(err, 'condition')$response$status_code, 500L)
obj$reset()
expect_equal(obj, cl) |
testCalibration <- function(img.dir, cal.file, corner.dir, sq.size, nx, ny, error.dir = NULL,
verify.dir = NULL, print.progress = TRUE, plot.dir = NULL){
if(!is.null(plot.dir)) error.dir <- plot.dir
cal.list <- XML4R2list(file=cal.file)$calibration
cal_coeff <- cal.list$cal.coeff
img_type <- cal.list$img.type
imgs_list_files <- list.files(img.dir)
num_views <- length(imgs_list_files)
img_fpaths <- paste0(img.dir, '/', imgs_list_files)
img_sub_dir <- gsub('(.mov|.avi|.mp4|.mpg)$', '', imgs_list_files, ignore.case=TRUE)
img_sub_dir_salign <- (1 + max(nchar(img_sub_dir))) - nchar(img_sub_dir)
if(!is.null(error.dir)) if(!file.exists(error.dir)) dir.create(path=error.dir)
if(!file.exists(corner.dir)) dir.create(path=corner.dir)
for(dir_name in img_sub_dir) if(!file.exists(paste0(corner.dir, '/', dir_name))) dir.create(paste0(corner.dir, '/', dir_name))
sq.size.num <- as.numeric(gsub('[[:alpha:], ]', '', sq.size))
sq.size.units <- gsub('[[:digit:]., ]', '', sq.size)
img_fnames <- NULL
vid_fnames <- NULL
verify_fpaths <- NULL
if(img_type == 'image'){
img_fnames_v1 <- list.files(paste0(img.dir, '/', imgs_list_files[1]))
img_fnames_v2 <- list.files(paste0(img.dir, '/', imgs_list_files[2]))
img_fnames <- img_fnames_v1[img_fnames_v1 %in% img_fnames_v2]
}else if(img_type == 'video'){
vid_fnames <- setNames(imgs_list_files, gsub('[.][A-Za-z0-9]*$', '', imgs_list_files))
}
if(!is.null(verify.dir)){
if(!file.exists(verify.dir)) dir.create(verify.dir)
for(dir_name in img_sub_dir) if(!file.exists(paste0(verify.dir, '/', dir_name))) dir.create(paste0(verify.dir, '/', dir_name))
verify_fpaths <- paste0(verify.dir, '/', list.files(verify.dir))
if(img_type == 'image') verify_fnames <- img_fnames
}
if(print.progress){
cat("calibrateCameras\n\n")
}
if(print.progress) cat("\tTest checkerboard corner detection...")
detect_corners <- TRUE
list_files_length <- rep(NA, num_views)
for(i in 1:num_views) list_files_length[i] <- length(list.files(paste0(corner.dir, '/', img_sub_dir[i])))
if(sum(list_files_length > 0) == num_views){
if(print.progress){
cat(paste0("Saved calibration corners found for all views in '", corner.dir, "' folder.\n\n"))
for(i in 1:num_views){
num_frames_detected <- length(list.files(paste0(corner.dir, '/', img_sub_dir[i])))
if(img_type == 'image'){
cat(paste0("\t\t", img_sub_dir[i], paste(rep(' ', img_sub_dir_salign[i]), collapse='')))
cat(paste0(": Corners detected in ", num_frames_detected, " aspects\n"))
}else{
cat(paste0("\t\t", vid_fnames[i], paste(rep(' ', img_sub_dir_salign[i]), collapse='')))
cat(paste0(": Corners detected in ", num_frames_detected, " frames\n"))
}
}
}else{
if(print.progress) cat('\n\n')
}
detect_corners <- FALSE
response <- readline(prompt="\n\t\tDo you wish to re-detect the calibration corners? (y/n) : ");
if(print.progress) cat("\n")
if(tolower(response) %in% c('yes', 'y')) detect_corners <- TRUE
}else{
if(print.progress) cat('\n')
}
if(detect_corners){
if(img_type == 'image'){
cal_corners <- array(NA, dim=c(nx*ny, 2, length(img_fnames), num_views))
if(print.progress) cat("\t\tRunning automated checkerboard corner detection on calibration images...\n")
for(i in 1:length(img_fnames)){
if(print.progress) cat("\t\t\t", img_fnames[i], "\n", sep="")
for(j in 1:num_views){
verify_fpath <- NULL
if(!is.null(verify_fpaths)) verify_fpath <- paste0(verify_fpaths[j], '/', verify_fnames[i])
corner_fpath <- paste0(corner.dir, '/', img_sub_dir[j], '/', gsub('[.][A-Za-z]+$', '.txt', img_fnames[i]))
if(cal.list$flip.view && j == 2){flip <- TRUE}else{flip <- FALSE}
cal_corners[, , i, j] <- findCheckerboardCorners(image.file=paste0(img_fpaths[j], '/', img_fnames[i]),
nx=nx, ny=ny, flip=flip, corner.file=corner_fpath, verify.file=verify_fpath, print.progress=FALSE)
if(print.progress){
cat("\t\t\t\tView ", j, " : ", sep="")
if(is.na(cal_corners[1, 1, i, j])){cat("findCheckerboardCorners() unsuccessful")}else{cat(nx*ny, " corners found", sep="")}
cat("\n")
}
}
}
dimnames(cal_corners) <- list(NULL, NULL, gsub('[.][A-Za-z0-9]*$', '', img_fnames), img_sub_dir)
if(print.progress) cat('\n')
}
}
if(!detect_corners || img_type == 'video'){
frame_names <- c()
for(i in 1:num_views) frame_names <- c(frame_names, gsub('.txt', '', list.files(paste0(corner.dir[i], '/', img_sub_dir[i]))))
frame_names_unique <- unique(frame_names)
cal_corners <- array(NA, dim=c(nx*ny, 2, length(frame_names_unique), num_views),
dimnames=list(NULL, NULL, frame_names_unique, img_sub_dir))
for(i in 1:num_views){
corner_files <- gsub('.txt', '', list.files(paste0(corner.dir, '/', img_sub_dir[i])))
for(j in 1:length(corner_files)){
cal_corners[, , corner_files[j], i] <-
as.matrix(read.table(paste0(corner.dir, '/', img_sub_dir[i], '/', corner_files[j], '.txt')))
}
}
}
aspect_non_na <- rowSums(apply(!is.na(cal_corners), c(3, 4), 'sum') > 0)
cal_min_views_found <- aspect_non_na >= 2
cal_views_found_num <- sum(cal_min_views_found)
non_na_by_view <- apply(!is.na(cal_corners), c(3, 4), 'sum') > 0
if(print.progress){
cat(paste0("\t\tNumber of cases in which corners were found in at least ", 2, " views: ", cal_views_found_num, "\n"))
if(img_type == 'image') cat(paste0("\t\t\tFilenames: ", paste0(gsub('.jpeg|.jpg|.tiff', '', img_fnames[cal_min_views_found], ignore.case=TRUE), collapse=", "), "\n"))
}
cal_corners <- cal_corners[, , cal_min_views_found, ]
dlt_test <- createErrorPlots(cal.coeff=cal_coeff, corners=cal_corners, nx=nx, sq.size.num=sq.size.num,
sq.size.units=sq.size.units, file=error.dir)
if(print.progress) print(summary(dlt_test, print.tab='\t'))
} |
COLORTAB <- NULL
describe.col <- function(col, show.hex=TRUE, check.palette.index=TRUE)
{
init.COLORTAB()
must.convert <- TRUE
if(is.numeric(col)) {
if(!isTRUE(all.equal(floor(col), col)))
stop0("non-integer col is illegal")
if(is.matrix(col)) {
if(length(col) == 3)
must.convert <- FALSE
else
stop0("bad format col")
} else if(length(col) != 1)
stop0("only one color is allowed")
else if(check.palette.index) {
if(col < 0)
stop0("col ", col,
" is illegal (col must be greater than or equal to 0)")
else if(col > length(palette()))
stop0("illegal col ", col,
" (only ", length(palette()),
" colors in the current palette)")
}
if(is.zero(col) || is.na(col))
col <- par("bg")
}
if(must.convert)
col <- col2rgb(col)
if(length(col) != 3)
stop0("only one color is allowed")
ret <- get.closest.col(col)
icol <- ret$icol
dist <- ret$dist
closest.col.name <- colors()[icol]
paste0(rgb(col[1], col[2], col[3], maxColorValue=255),
" (",
ifelse(dist != 0, "near ", ""),
closest.col.name,
ifelse(show.hex && dist != 0, " ", ""),
ifelse(show.hex && dist != 0,
rgb(COLORTAB[icol,1], COLORTAB[icol,2], COLORTAB[icol,3],
maxColorValue=255),
""),
")")
}
init.COLORTAB <- function()
{
if(is.null(COLORTAB)) {
colors <- colors()
tab <- matrix(nrow=length(colors), ncol=3)
for(i in 1:length(colors()))
tab[i,] <- col2rgb(colors[i])
unlockBinding("COLORTAB", asNamespace("rpart.plot"))
COLORTAB <<- tab
lockBinding("COLORTAB", asNamespace("rpart.plot"))
}
}
get.closest.col <- function(col)
{
dist <- icol <- Inf
for(i in 1:nrow(COLORTAB)) {
this.dist <- sum(abs(COLORTAB[i,] - col))
if(this.dist < dist) {
dist <- this.dist
icol <- i
}
}
list(icol=icol, dist=dist)
} |
NULL
setGeneric (
name= "calcProducerSurplus",
def=function(object,...){standardGeneric("calcProducerSurplus")}
)
setGeneric (
name= "calcProducerSurplusGrimTrigger",
def=function(object,...){standardGeneric("calcProducerSurplusGrimTrigger")}
)
setMethod(
f= "calcProducerSurplus",
signature= "Bertrand",
definition=function(object,preMerger=TRUE){
margins <- calcMargins(object,preMerger,level=TRUE)
output <- calcQuantities(object,preMerger)
if (all(is.na(output))){
warning("'calcQuantities' yielded all NAs. Using 'calcShares' instead")
output <- calcShares(object,preMerger,revenue=FALSE)
}
ps <- margins * output
names(ps) <- object@labels
return(ps)
}
)
setMethod(
f= "calcProducerSurplus",
signature= "VertBargBertLogit",
definition=function(object,preMerger=TRUE){
mktSize <- object@down@mktSize
margins <- calcMargins(object,preMerger=preMerger,level=TRUE)
output <- calcShares(object,preMerger)
if (is.na(mktSize)){
warning("'calcQuantities' yielded all NAs. Using 'calcShares' instead")
mktSize <- 1
}
psup <- margins$up * output * mktSize
psdown <- margins$down * output * mktSize
names(psup) <- names(psdown) <- object@down@labels
return(list(up=psup,down=psdown))
}
)
setMethod(
f= "calcProducerSurplus",
signature= "Auction2ndCap",
definition=function(object,preMerger=TRUE,exAnte=TRUE){
sellerCostBounds <-object@sellerCostBounds
if(preMerger){r <- object@reservePre}
else{r <- object@reservePost}
if(preMerger) { capacities = object@capacities }
else { capacities = tapply(object@capacities*(1+object@mcDelta),object@ownerPost,sum) }
totCap = sum(capacities)
espIntegrand = function(c,t){
sellerCostParms <- c(list(c),as.list(object@sellerCostParms),
lower.tail=as.list(object@sellerCostCDFLowerTail))
Fc <- do.call(match.fun(object@sellerCostCDF),sellerCostParms)
val <- (1-Fc)^(totCap-t)-(1-Fc)^totCap
}
retval <- sapply(
capacities,
function(t.i) {
if( r < sellerCostBounds[2]) {
retval <- integrate(espIntegrand,lower=sellerCostBounds[1],upper=r,
stop.on.error = FALSE,t=t.i)$value
}
else {
retval <- integrate(espIntegrand,lower=sellerCostBounds[1],upper=sellerCostBounds[2],
stop.on.error = FALSE,t=t.i)$value
}
return(retval)
})
if(!preMerger){
temp <- rep(NA, length(object@ownerPre))
temp[object@ownerPre == object@ownerPost] <- retval
retval <- temp
}
if(!exAnte){retval <- retval/calcShares(object,preMerger=preMerger,exAnte=TRUE)}
return(retval)
})
setMethod(
f= "calcProducerSurplus",
signature= "Cournot",
definition=function(object,preMerger=TRUE){
rev <- calcRevenues(object, preMerger= preMerger)
vc <- calcVC(object, preMerger= preMerger)
ps <- rowSums(rev, na.rm=TRUE) - vc
names(ps) <- object@labels[[1]]
return(ps)
}
)
setMethod(
f= "calcProducerSurplusGrimTrigger",
signature= "Bertrand",
definition= function(object,coalition,discount,preMerger=TRUE,isCollusion=FALSE,...){
subset <- object@subset
nprod <- length(object@labels)
if(!is.numeric(coalition) ||
length(coalition) > nprod ||
!coalition %in% 1:nprod){
stop ("'coalition' must be a vector of product indices no greater than the number of products")
}
if(any(discount<=0 | discount>=1,na.rm=TRUE)){
stop ("'discount' must be a vector of values between 0 and 1 or NA")
}
if(preMerger){owner <- object@ownerPre}
else{owner <- object@ownerPost}
anyProds <- as.logical(apply(owner[coalition,]>0,2,max))
if(any(is.na(discount[anyProds]))){
stop("'discount' must include the discount factors for all products produced by firms with products in the coalition")}
if(isCollusion){
ownerPre <- object@ownerPre
object@ownerPre[coalition,coalition] <- 1
object <- calcSlopes(object)
object@mcPre <- calcMC(object,TRUE)
object@mcPost <- calcMC(object,FALSE)
object@ownerPre <- ownerPre
}
psPunish <- calcProducerSurplus(object,preMerger)
owner <- ownerToVec(object,preMerger)
if(preMerger){
ownerPre <- object@ownerPre
object@ownerPre[coalition,coalition] <- 1
ownerCoalition <- object@ownerPre
object@pricePre <- calcPrices(object,preMerger,...)
psCoord <- calcProducerSurplus(object,preMerger)
psDefect <- psPunish
for(c in unique(owner[coalition])){
thisOwner <- c==owner
object@ownerPre <- ownerCoalition
object@ownerPre[thisOwner,] <- ownerPre[thisOwner,]
object@pricePre <- calcPrices(object,preMerger,...)
psDefect[thisOwner] <- calcProducerSurplus(object,preMerger)[thisOwner]
}
IC <- as.vector(ownerPre %*% (psCoord/(1-discount))) >
as.vector(ownerPre %*% (psDefect + (psPunish*discount/(1-discount))))
}
else{
ownerPost <- object@ownerPost
object@ownerPost[coalition,coalition] <- 1
ownerCoalition <- object@ownerPost
object@pricePost <- calcPrices(object,preMerger,subset=subset,...)
psCoord <- calcProducerSurplus(object,preMerger)
psDefect <- psPunish
for(c in unique(owner[coalition])){
thisOwner <- c==owner
object@ownerPost <- ownerCoalition
object@ownerPost[thisOwner,] <- ownerPost[thisOwner,]
object@pricePost <- calcPrices(object,preMerger,subset=subset,...)
psDefect[thisOwner] <- calcProducerSurplus(object,preMerger)[thisOwner]
}
IC <- as.vector(ownerPost %*% (psCoord/(1-discount))) >=
as.vector(ownerPost %*% (psDefect + (psPunish*discount/(1-discount))))
}
result <- data.frame(Coalition=coalition,Discount=discount,Coord=psCoord,Defect=psDefect,Punish=psPunish,IC=IC)
rownames(result) <- object@labels
result <- result[anyProds,]
return(result)
}
) |
get_data360 <- function(site = "tc", indicator_id = NULL, dataset_id = NULL, country_iso3 = NULL, timeframes = NULL, output_type = "wide") {
nondate_cols <- c("Country ISO3", "Country Name", "Dataset", "dataset_id", "Indicator", "Subindicator Type", "Product", "Partner")
if (site == "tc") {
api_base <- "http://tcdata360-backend.worldbank.org/api/v1/"
} else if (site == "gov") {
api_base <- "http://govdata360-backend.worldbank.org/api/v1/"
} else {
stop("site parameter should only be either 'tc' or 'gov'. Please try again.")
}
if (!(output_type %in% c("wide", "long"))) {
stop("output_type parameter should only be either 'wide' or 'long'. Please try again.")
}
if ((is.null(indicator_id) == FALSE) && (is.null(dataset_id) == FALSE)) {
stop("indicator_id and dataset_id parameters cannot be both non-NULL.
Hint: If you want to download a certain indicator(s) only, list these down in indicator_id as a vector,
and use dataset_id == NULL.")
} else if (((is.null(indicator_id) == TRUE) && (is.null(dataset_id) == TRUE) && (is.null(country_iso3) == TRUE) && (is.null(timeframes) == FALSE))) {
stop("timeframes parameter cannot be non-NULL while the other parameters are NULL, since data request is too large.
Hint: Add inputs to the other parameters to constrain the data request.")
}
if (is.null(indicator_id) && is.null(timeframes)) {
if (is.null(dataset_id) && is.null(country_iso3)) {
stop("the site parameters indicator_id, dataset_id, country_iso3, and timeframes cannot all be NULL.")
} else if ((is.null(dataset_id) != is.null(country_iso3))) {
if (!is.null(dataset_id) && is.null(country_iso3)) {
api_endpoint <- "datasets/"
query <- "/dump.csv"
item_list <- dataset_id
item_name <- "dataset_id"
} else if (is.null(dataset_id) && !is.null(country_iso3)) {
api_endpoint <- "countries/"
query <- "/dump.csv"
qtype <- "countrydump"
item_list <- country_iso3
item_name <- "Country ISO3"
}
df_compiled <- data.table::data.table()
for (item in item_list) {
dl_url <- paste(api_base, api_endpoint, item, query, sep = "")
df <- data.table::fread(dl_url, header = TRUE, showProgress = FALSE)
df <- cbind(df, placeholder_name = item)
names(df)[names(df) == "placeholder_name"] <- item_name
df_compiled <- data.table::rbindlist(list(df_compiled, df), fill = TRUE)
}
}
} else {
api_endpoint <- "data.csv?"
if (!is.null(indicator_id)) {
indicators <- paste(c("indicators=", indicator_id), collapse = "%2C")
} else {
indicators <- ""
}
if (!is.null(country_iso3)) {
countries <- paste(c("countries=", country_iso3), collapse = "%2C")
} else {
countries <- ""
}
if (!is.null(timeframes)) {
timefram <- paste(c("timeframes=", timeframes), collapse = "%2C")
} else {
timefram <- ""
}
query <- paste(c(countries, indicators, timefram), collapse = "&")
dl_url <- paste(api_base, api_endpoint, query, sep = "")
df_compiled <- data.table::fread(dl_url, header = TRUE, showProgress = FALSE)
names(df_compiled)[names(df_compiled) == "Country ID"] <- "Country ISO3"
names(df_compiled)[names(df_compiled) == "Value Type"] <- "Subindicator Type"
}
if (output_type == "long") {
df_compiled <- reshape2::melt(df_compiled, id.vars = intersect(nondate_cols, names(df_compiled)), variable.name = "Period", value.name = "Observation")
}
return(df_compiled)
} |
yh_logistic <- function(dfTr, dfTe, alpha=NULL){
fixupFactor <- function(u) factor(as.character(u))
p <- ncol(dfTr)-1
X <- dfTr[,1:p]
y <- fixupFactor(dfTr[,p+1])
stopifnot(length(levels(y))==2)
Xte <- dfTe[,1:p]
yte <- fixupFactor(dfTe[,p+1])
if (is.null(alpha)) {
ans<- glm(y ~., data=X, family="binomial")
prob <- ifelse(predict.glm(ans, newdata=Xte, type="response")<0.5, 1, 2)
yh <- levels(y)[prob]
} else {
stopifnot(alpha<=1 || alpha>=0)
X <- as.matrix.data.frame(X)
Xte <- as.matrix.data.frame(Xte)
ans<- glmnet(x=X, y=y, family="binomial", alpha=alpha)
ans_cv <- cv.glmnet(X, y=y, family="binomial", alpha=alpha)
lambdaHat <- ans_cv$lambda.1se
yh <- predict(ans, newx=Xte, type="class", s=lambdaHat)[,1]
}
yh <- factor(yh)
unlist(list(cost=misclassificationrate(yte, yh),
pcor=cor(as.numeric(yte), as.numeric(yh))))
} |
chr.disp.sim <- function(phy, n.steps=1000, sigma=1, a=0, ntraits=1, sympatry=NA, allopatry=NA, trait.lim=NA) {
phy.names <- phy$tip.label
phy.chr.disp <- checktree(phy)
num_tips <- length(phy.chr.disp$data_order)
splitting_nodes <- phy.chr.disp$splitting_nodes - 1
times <- phy.chr.disp$times
tval <- rep(0, num_tips * ntraits)
dt <- nodeTimes(phy)[1,1] / n.steps
symp <- vectortime(sympatry, 0, num_tips)
allo <- vectortime(allopatry, 99e9, num_tips )
if(is.na(trait.lim)) trait.lim <- 9e99
result <- .C("pathsim", ntip=as.integer(num_tips), dt=as.double(dt), rate = as.double(sigma^2), a=as.double(a), r_intervals=as.double(times), splitters=as.integer(splitting_nodes), tval = as.double(tval), ntraits=as.integer(ntraits), symp=as.double(symp), allo=as.double(allo), lim=as.numeric(trait.lim))
result$tval <- as.matrix(reorder_data(phy.chr.disp, result$tval, ntraits))
rownames(result$tval) <- phy.names
if(all(result$symp == 0)) result$symp <- NULL
if(all(result$allo == 0)) result$allo <- NULL
result
} |
kConstantSLP = 1013.25
kConstantP0 = 1000.0
kConstantSpeedOfLight = 3e8
kConstantRe = 6374000.0
kConstantR43 = kConstantRe*4.0/3.0
kConstantBoltz = 1.381e-23
AttenuationAbsCoeff <- function(D, lam, m){
Km <- (m^2 - 1) / (m^2 + 2)
(pi^2 * D^3 / lam) * Im(-1 * Km)
}
AttenuationScatCoeff<- function(D, lam, m){
Km = (m^2 - 1) / (m^2 + 2)
(2 * pi^5 * D^6 / (3 * lam^4) * (abs(Km))^2)
}
AttenuationExtCoeff<- function(D,lam,m){
Qa <- AttenuationAbsCoeff(D,lam,m)
Qs <- AttenuationScatCoeff(D,lam,m)
Qa + Qs
}
ConversiondBZ2Z<- function(dBZ){
10^(dBZ/10)
}
ConversionZ2dBZ<- function(Zlin){
10 * log10(Zlin)
}
DopplerFreq<- function(lam, speedOfLight){
speedOfLight/lam
}
DopplerWavelength<- function(freq,speedOfLight){
speedOfLight/freq
}
DopplerPulseDuration<- function(tau, speedOfLight){
2 * tau/speedOfLight
}
DopplerPulseLength<- function(pDur, speedOfLight){
speedOfLight * pDur/2
}
DopplerFmax<- function(PRF){
PRF/2
}
DopplerVmax<- function(PRF, lam){
PRF * lam / 4
}
DopplerRmax<- function(PRF,speedOfLight){
speedOfLight / (2 * PRF)
}
DopplerDilemma<- function(inFloat, lam,speedOfLight){
(speedOfLight * lam / 8) / inFloat
}
DopplerVshift<- function(GS, psi){
GS * cos(pi/360*(psi))
}
DopplerVmaxDual<- function(lam, PRF1, PRF2){
lam / (4 * ((1 / PRF1) - (1 / PRF2)))
}
GeometryReffective<- function(dNdH=-39e-6, earthRadius){
(1 / ((1/(earthRadius/1000)) + (dNdH))) * 1000
}
GeometryHalfPowerRadius<- function(r, bwhalf){
(r * pi/360*(bwhalf)) / 2
}
GeometryRayHeight<- function(r, elev, H0, R1=kConstantR43){
Term1 = sqrt(r^2 +R1^2 + 2*r*R1*sin(pi/360*(elev)))
Term1 - R1 + H0
}
GeometrySampleVolIdeal<- function(r, bwH, bwV, pLength){
pi * (r * pi/360*(bwH)/2) * (r * pi/360*(bwV)/2) * (pLength/2)
}
GeometrySampleVolGauss<- function(r, bwH, bwV, pLength){
Numer = pi * r^2 * pi/360*(bwH) * pi/360*(bwV) * pLength
Denom = 16 * log(2)
Numer / Denom
}
GeometryRangeCorrect<- function(r, h, E){
n<-length(h)
dh1 = h[2:n] - h[1:(n-1)]
dh2 = c(h[1],dh1)
a90r = pi/2
dr = dh2 / (tan(a90r - pi/360*(E)))
cumsum(dr)
}
GeometryBeamBlockFrac<- function(Th, Bh, a){
y = Th - Bh
Numer = (y * sqrt(a^2 - y^2)) + (a^2 * asin(y/a)) + (pi * a^2 /2)
Denom = pi * a^2
Numer / Denom
}
SystemGainPratio<- function(P1, P2){
10 * log10(P1 / P2)
}
SystemFreq<- function(lam, speedOfLight){
speedOfLight / lam
}
Systemwavelength<- function(freq, speedOfLight){
speedOfLight / freq
}
SystemRadarConst<- function(Pt, G, Tau, lam, bwH, bwV, Lm, Lr){
Lmlin = 10^(Lm / 10)
Lrlin = 10^(Lr / 10)
Glin = 10^(G / 10)
bwHr = pi/360*(bwH)
bwVr = pi/360*(bwV)
Numer = pi^3 * c * Pt * Glin^2 * Tau * bwHr * bwVr * Lmlin * Lrlin
Denom = 1024 *log(2) * lam^2
Numer/Denom
}
SystemAntEffArea<- function(G, lam){
Glin = 10^(G / 10)
Glin * lam^2 / (4 * pi)
}
SystemPowerTarget<- function(Pt, G, Asig, r){
Glin = 10^(G / 10)
(Pt * Glin * Asig) / (4 * pi * r^2)
}
SystemXsecBscatterSphere<- function(D, lam, K=0.93){
(pi^5 * K^2 * D^6) / lam^4
}
SystemNormXsecBscatterSphere<- function(D, lam, K=0.93){
sig = SystemXsecBscatterSphere(D, lam, K)
sig/ (pi * (D/2)^2)
}
SystemSizeParam<- function(D, lam){
2 * pi * D/2 / lam
}
SystemPowerReturnTarget<- function(Pt, G, lam, sig, r){
Glin = 10^(G/10)
(Pt * Glin^2 * lam^2 * sig) / (64 * pi^3 * r^4)
}
SystemThermalNoise<- function(Bn, Units, Ts=290, k=kConstantBoltz){
N = k * Ts * Bn
if (toupper(Units)=='W') Nt = N else {
if (toupper(Units)=='DBM') Nt = 10 * log10(N/10^-3) else {
warning( "Units must be in 'W' or 'dBm'")
Nt = NA
}
}
Nt
}
VariablesReflectivity<- function(Pt, G, Tau, lam, bwH, bwV, Lm, Lr, Pr, r, K=0.93){
C1 = SystemRadarConst(Pt, G, Tau, lam, bwH, bwV, Lm, Lr)
Pr * r^2 / (C1 * K^2)
}
VariablesRadVel<- function(f,lam){
f * lam / 2
}
VariablesCDR<- function(Zpar, Zorth){
10* log10(Zpar/Zorth)
}
VariablesLDR<- function(Zh, Zv){
10 * log10(Zh / Zv)
}
VariablesZDR<- function(Zh, Zv){
10 * log10(Zh / Zv)
}
VariablesZDP<- function(Zh, Zv){
if (Zh > Zv){
ZDP = 10* log10(Zh - Zv)
} else{
warning("Zh < Zv !")
ZDP = NA
}
ZDP
}
VariablesHDR<- function(dBZh, ZDR){
if (ZDR <= 0) f = 27 else {
if ((ZDR > 0) & (ZDR <= 1.74)) f = 19 * ZDR + 27 else if (ZDR > 1.74) f = 60
}
dBZh - f
} |
assess_missing_data_tsne <- function(vcfR,
popmap=NULL,
thresholds=NULL,
perplexity=NULL,
iterations=NULL,
initial_dims=NULL,
clustering=TRUE){
V1<- NULL
V2<- NULL
pop<- NULL
if (class(vcfR) != "vcfR"){
stop("specified vcfR object must be of class 'vcfR'")
}
if (is.null(popmap)){
stop("popmap must be provided in order to compare clustering of a priori defined groups")
}
if (class(popmap) != "data.frame"){
stop("popmap must be of class 'data.frame'")
}
if (colnames(popmap)[1] != "id"){
stop("popmap must be a dataframe with column 1 named 'id'")
}
if (colnames(popmap)[2] != "pop"){
stop("popmap must be a dataframe with column 2 named 'pop'")
}
if (length(popmap$id) != length(colnames(vcfR@gt))-1){
stop("popmap ID's must match exactly the ID's in input vcf")
}
if (all(popmap$id %in% colnames(vcfR@gt)) == FALSE){
stop("popmap ID's must match exactly the ID's in input vcf")
}
if (is.null(perplexity)){
w<-5
} else{
w<-perplexity
}
if (is.null(iterations)){
q<-1000
} else{
q<-iterations
}
if (is.null(initial_dims)){
p<-5
} else{
p<-initial_dims
}
gt.matrix<-vcfR::extract.gt(vcfR)
gt.matrix[gt.matrix == "0/0"]<-0
gt.matrix[gt.matrix == "0/1"]<-1
gt.matrix[gt.matrix == "1/1"]<-2
class(gt.matrix) <- "numeric"
sfs<-rowSums(gt.matrix, na.rm = TRUE)
g<-sum(sfs < 1)
if (g != 0){
stop("invariant SNPs detected in input vcf. Invariant sites must be filtered prior to input")
}
miss<-colSums(is.na(gt.matrix))/nrow(gt.matrix)
if (clustering == TRUE){
if (is.null(thresholds)) {
gen<-vcfR::vcfR2genlight(vcfR)
pca<-adegenet::glPca(gen,
nf=length(levels(as.factor(popmap$pop)))+2)
pca.scores<-as.data.frame(pca$scores)
tsne_p5<- Rtsne::Rtsne(pca.scores,
max_iter=q,
perplexity=w,
initial_dims=p)
tsne.df<-as.data.frame(tsne_p5$Y)
tsne.df<-tsne.df[,c("V1","V2")]
m=c()
for (z in 2:(length(levels(as.factor(popmap$pop)))+2)){
m[z]<-mean(cluster::silhouette(cluster::pam(tsne.df, z))[, "sil_width"])
}
plot(m,
type = "o",
xlab = "K",
ylab = "PAM silhouette",
main=paste0("t-SNE PAM clustering"))
pam.df<-data.frame(n.groups=2:(length(levels(as.factor(popmap$pop)))+2),
likelihood=m[-1])
pam.clust<-cluster::pam(tsne.df, pam.df$n.groups[pam.df$likelihood==max(pam.df$likelihood)])
tsne.df$pop<-popmap$pop[order(popmap$id == colnames(vcfR@gt)[-1])]
tsne.df$pam.clust<-pam.clust$clustering
tsne.df$missing<-miss
print(
ggplot2::ggplot(tsne.df,
ggplot2::aes(x=V1,
y=V2,
color=pop,
shape=as.factor(pam.clust))
) +
ggplot2::ggtitle(paste0("t-SNE clustering analysis"))+
ggplot2::geom_point(cex = 4,
alpha=.75)+
ggplot2::theme_classic()
)
print(
ggplot2::ggplot(tsne.df,
ggplot2::aes(x=V1,
y=V2,
color=missing)
) +
ggplot2::ggtitle(paste0("t-SNE clustering analysis"))+
ggplot2::geom_point(cex = 4,
alpha=.75)+
ggplot2::labs(color = "proportion\nmissing data")+
ggplot2::theme_classic()
)
df<-data.frame(tsne.ax1=tsne.df$V1,
tsne.ax2=tsne.df$V2,
popmap.pop=popmap$pop,
pam.pop=as.factor(pam.clust$clustering),
missing=tsne.df$missing)
return(df)
}
else{
dfs<-list()
j<-1
for (i in thresholds){
if (i < 0 | i > 1){
stop("specified threshold must be a proportion between 0 and 1")
}
vcfR.filt<-SNPfiltR::missing_by_snp(vcfR = vcfR,
cutoff = i)
gen<-vcfR::vcfR2genlight(vcfR.filt)
pca<-adegenet::glPca(gen,
nf=length(levels(as.factor(popmap$pop)))+2)
pca.scores<-as.data.frame(pca$scores)
tsne_p5<- Rtsne::Rtsne(pca.scores,
max_iter=q,
perplexity=w,
initial_dims = p)
tsne.df<-as.data.frame(tsne_p5$Y)
tsne.df<-tsne.df[,c("V1","V2")]
m=c()
for (z in 2:(length(levels(as.factor(popmap$pop)))+2)){
m[z]<-mean(cluster::silhouette(cluster::pam(tsne.df, z))[, "sil_width"])
}
plot(m,
type = "o",
xlab = "K",
ylab = "PAM silhouette",
main=paste0("t-SNE ",i*100,"% SNP completeness cutoff PAM clustering"))
pam.df<-data.frame(n.groups=2:(length(levels(as.factor(popmap$pop)))+2),
likelihood=m[-1])
pam.clust<-cluster::pam(tsne.df, pam.df$n.groups[pam.df$likelihood==max(pam.df$likelihood)])
tsne.df$pop<-popmap$pop[order(popmap$id == colnames(vcfR.filt@gt)[-1])]
tsne.df$pam.clust<-pam.clust$clustering
tsne.df$missing<-miss
print(
ggplot2::ggplot(tsne.df,
ggplot2::aes(x=V1,
y=V2,
color=pop,
shape=as.factor(pam.clust))
) +
ggplot2::ggtitle(paste0("t-SNE clustering analysis ",i*100,"% SNP completeness cutoff"))+
ggplot2::geom_point(cex = 4,
alpha=.75)+
ggplot2::theme_classic()
)
print(
ggplot2::ggplot(tsne.df,
ggplot2::aes(x=V1,
y=V2,
color=missing)
) +
ggplot2::ggtitle(paste0("t-SNE clustering analysis ",i*100,"% SNP completeness cutoff"))+
ggplot2::geom_point(cex = 4,
alpha=.75)+
ggplot2::labs(color = "proportion\nmissing data")+
ggplot2::theme_classic()
)
dfs[[j]]<-tsne.df
j<-j+1
tsne.df<-NULL
}
rm(j)
return(dfs)
}
}
if (clustering == FALSE){
if (is.null(thresholds)) {
gen<-vcfR::vcfR2genlight(vcfR)
pca<-adegenet::glPca(gen,
nf=length(levels(as.factor(popmap$pop)))+2)
pca.scores<-as.data.frame(pca$scores)
tsne_p5<- Rtsne::Rtsne(pca.scores,
max_iter=q,
perplexity=w,
initial_dims=p)
tsne.df<-as.data.frame(tsne_p5$Y)
tsne.df<-tsne.df[,c("V1","V2")]
tsne.df$pop<-popmap$pop[order(popmap$id == colnames(vcfR@gt)[-1])]
tsne.df$missing<-miss
print(
ggplot2::ggplot(tsne.df,
ggplot2::aes(x=V1,
y=V2,
color=pop)
) +
ggplot2::ggtitle(paste0("t-SNE clustering analysis"))+
ggplot2::geom_point(cex = 4,
alpha=.75)+
ggplot2::theme_classic()
)
print(
ggplot2::ggplot(tsne.df,
ggplot2::aes(x=V1,
y=V2,
color=missing)
) +
ggplot2::ggtitle(paste0("t-SNE clustering analysis"))+
ggplot2::geom_point(cex = 4,
alpha=.75)+
ggplot2::labs(color = "proportion\nmissing data")+
ggplot2::theme_classic()
)
df<-data.frame(tsne.ax1=tsne.df$V1,
tsne.ax2=tsne.df$V2,
popmap.pop=popmap$pop)
return(df)
}
else{
dfs<-list()
j<-1
for (i in thresholds){
if (i < 0 | i > 1){
stop("specified threshold must be a proportion between 0 and 1")
}
vcfR.filt<-SNPfiltR::missing_by_snp(vcfR = vcfR,
cutoff = i)
gen<-vcfR::vcfR2genlight(vcfR.filt)
pca<-adegenet::glPca(gen,
nf=length(levels(as.factor(popmap$pop)))+2)
pca.scores<-as.data.frame(pca$scores)
tsne_p5<- Rtsne::Rtsne(pca.scores,
max_iter=q,
perplexity=w,
initial_dims = p)
tsne.df<-as.data.frame(tsne_p5$Y)
tsne.df<-tsne.df[,c("V1","V2")]
tsne.df$pop<-popmap$pop[order(popmap$id == colnames(vcfR.filt@gt)[-1])]
tsne.df$missing<-miss
print(
ggplot2::ggplot(tsne.df,
ggplot2::aes(x=V1,
y=V2,
color=pop)
) +
ggplot2::ggtitle(paste0("t-SNE clustering analysis ",i*100,"% SNP completeness cutoff"))+
ggplot2::geom_point(cex = 4,
alpha=.75)+
ggplot2::theme_classic()
)
print(
ggplot2::ggplot(tsne.df,
ggplot2::aes(x=V1,
y=V2,
color=missing)
) +
ggplot2::ggtitle(paste0("t-SNE clustering analysis ",i*100,"% SNP completeness cutoff"))+
ggplot2::geom_point(cex = 4,
alpha=.75)+
ggplot2::labs(color = "proportion\nmissing data")+
ggplot2::theme_classic()
)
dfs[[j]]<-tsne.df
j<-j+1
tsne.df<-NULL
}
rm(j)
return(dfs)
}
}
} |
theme_facet<- function (base_size = 11, base_family = "") {
theme_bw() %+replace%
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle = 90, hjust = 1),
strip.background = element_blank(),
strip.text = element_text(size=8, lineheight = 6),
panel.border = element_rect(fill = NA, colour = "grey"),
panel.spacing = unit(0,'lines')
)
}
ggplotGrid <- function(what, type, values, clustering, show.names,
names, the.grid, args = NULL) {
if(is.null(args$varname)) {
varname <- colnames(values)[1]
} else varname <- args$varname
labelcolor <- ""
if (is.null(args$labelcolor)) {
if (is.null(args$sc) | type == "color") {
if (type == "hitmap" | type == "poly.dist") {
labelcolor <- "Number of\nobservations"
} else if (what == "prototypes") {
labelcolor <- paste0("value of\n", varname, "\nfor each prototype")
} else {
labelcolor <- paste0("mean of\n", varname)
}
} else {
labelcolor <- "Super_Clusters"
}
} else {
labelcolor <- args$labelcolor
}
if (type != "poly.dist")
dataplot <- data.frame("varname" = as.matrix(values)[, 1],
"SOMclustering" = clustering,
the.grid$coord[clustering,],
"Nb" = 1)
if (type == "poly.dist") {
maxi <- max(unlist(values))
mini <- min(unlist(values))
values <- lapply(values, function(x) (maxi - x)/ (maxi - mini))
values <- lapply(values, function(x) x * (0.45-0.05) + 0.05)
dataplot <- lapply(1:length(values), function(x)
coords_polydist(x, values, the.grid))
dataplot <- data.frame(do.call("rbind", dataplot))
if (is.null(args$sc)) {
datacolor <- data.frame(table(clustering), stringsAsFactors = FALSE)
colnames(datacolor) <- c("id", "varcolor")
} else {
datacolor <- data.frame("id" = 1:length(args$sc),
"varcolor" = as.character(args$sc))
}
dataplot$numrow <- rownames(dataplot)
dataplot <- merge(dataplot, datacolor, by="id", all.x = TRUE, sort = FALSE)
dataplot <- dataplot[order(dataplot$numrow), ]
if (is.null(args$sc)) {
dataplot$varcolor <- ifelse(is.na(dataplot$varcolor), 0, dataplot$varcolor)
}
tp <- ggplot(dataplot, aes_string(x = "x", y = "y")) +
geom_polygon(data=dataplot, aes_string(fill = "varcolor", group = "id"))
}
if (type == "hitmap") {
if (is.null(args$sc)) {
dataplot <- aggregate(data=dataplot, Nb ~ SOMclustering + x + y, length)
dataplot$varname <- dataplot$Nb
} else {
dataplot <- aggregate(data = dataplot,
Nb ~ SOMclustering + x + y + varname, length)
dataplot$varname <- as.factor(dataplot$varname)
}
tp <- ggplot(dataplot, aes_string(x = "x", y = "y")) +
geom_point(aes_string(size = "Nb", color = "varname")) +
scale_size_area(breaks=c(min(dataplot$Nb), median(dataplot$Nb),
max(dataplot$Nb)),
max_size=min(25,max(dataplot$Nb))) +
labs(size = "Number of\nobservations") + labs(color=labelcolor)
}
if (type == "color") {
dataplot <- aggregate(data = dataplot, varname ~ SOMclustering + x + y,
mean)
if (the.grid$topo == "square") {
tp <- ggplot(dataplot, aes_string(x = "x", y = "y", fill = "varname")) +
geom_bin2d(stat = "identity", linetype = 1, color = "grey")
} else {
if (requireNamespace("hexbin", quietly = TRUE)) {
tp <- ggplot(dataplot, aes_string(x = "x", y = "y", fill = "varname")) +
geom_hex(stat = "identity", linetype = 1, color = "grey")
} else {
stop("'hexbin' package required for this plot.", call. = TRUE)
}
}
}
if (type == "grid") {
dataplot <- aggregate(data = dataplot, varname ~ SOMclustering + x + y, mean)
if (the.grid$topo == "square") {
dataplot$varname <- factor(dataplot$varname)
tp <- ggplot(dataplot, aes_string(x = "x", y = "y", fill = "varname")) +
geom_bin2d(stat = "identity", linetype = 1, color = "grey", size = 0.6)
} else {
dataplot$varname <- factor(dataplot$varname)
if (requireNamespace("hexbin", quietly = TRUE)) {
tp <- ggplot(dataplot, aes_string(x = "x", y = "y", fill = "varname",
group = "1")) +
geom_hex(stat = "identity", linetype = 1, color = "grey", size = 0.6)
} else {
stop("'hexbin' package required for this plot.", call. = TRUE)
}
}
}
if (type != "poly.dist") {
tp <- tp + xlim(0.5, max(dataplot$x) + 0.5) + ylim(0.5, max(dataplot$y) + 0.5)
}
tp <- tp + ggtitle(myTitle(args, what)) + coord_fixed() +
labs(fill = labelcolor) + theme_void() + theme(panel.border=element_rect(fill = NA, colour = "grey"))
if (show.names) {
datagrid <- data.frame(the.grid$coord, names)
tp <- tp + geom_text(data = datagrid,
aes_string(x = "x", y = "y", label = "names",
fill = NULL))
}
tp
}
ggplotFacet <- function(what, type, values, clustering = NULL, show.names,
names, is.scaled, the.grid, args){
ordered.index <- orderIndexes(the.grid, type)
vary <- "values"
if (!(type %in% c("names", "words", "pie"))) {
if (is.scaled) {
values <- scale(values, is.scaled, is.scaled)
vary <- "scaled_values"
}
}
labely <- vary
if (what %in% c("obs", "add") & type %in% c("barplot", "meanline")) {
labely <- paste0("mean of ", labely)
}
if (what == "prototypes") {
labely <- "values for each prototype"
}
if (type == "names") {
labely <- "frequency of values"
if(type == "names" & !is.null(args$varname)) {
labely <- paste("frequency of", args$varname, "values")
}
if(type == "names" & args$varname %in% c("row.names", "names")) {
labely <- paste("repartition of", args$varname, "values")
}
}
dataplot <- data.frame(values)
nbvar <- ncol(dataplot)
colnames(dataplot)[1:nbvar] <- paste0(vary, "-", colnames(dataplot)[1:nbvar])
dataplot$ind <- rownames(dataplot)
dataplot$SOMclustering <- factor(clustering, levels = ordered.index)
if (is.null(args$sc)) {
dataplot <- reshape(dataplot, varying = 1:nbvar,
idvar = c("ind", "SOMclustering"), sep = "-",
direction = "long", timevar = "variable")
dataplot$variable <- as.factor(dataplot$variable)
labelcolor <- "variable"
} else {
dataplot$varcolor <- args$sc
dataplot <- reshape(dataplot, varying = 1:nbvar,
idvar = c("ind", "SOMclustering", "varcolor"),
sep = "-", direction = "long", timevar = "variable")
dataplot$varcolor <- as.factor(dataplot$varcolor)
labelcolor <- "Super_Clusters"
colnames(dataplot)[match("varcolor", colnames(dataplot))] <- labelcolor
}
if (type == "barplot") {
tp <- ggplot(dataplot,
aes_string(x = "variable", y = vary, fill = labelcolor)) +
geom_bar(stat = "summary", fun = mean, fun.args = list(na.rm = TRUE)) +
ylab(labely)
}
if (type == "boxplot") {
tp <- ggplot(dataplot,
aes_string(x = "variable", y = vary, fill = labelcolor)) +
geom_boxplot()
}
if (type == "lines") {
if (is.null(args$sc)) {
tp <- ggplot(dataplot,
aes_string(x = "variable", y = vary, group = "ind")) +
geom_line(alpha = 0.8) + ylab(labely)
} else {
tp <- ggplot(dataplot,
aes_string(x = "variable", y = vary, group = "ind",
color = labelcolor)) +
geom_line(alpha = 0.8) + ylab(labely)
}
}
if (type == "meanline") {
tp <- ggplot(dataplot, aes_string(x = "variable", y = vary, group = 1,
colour = labelcolor)) +
geom_point(stat = "summary", fun = mean, fun.args = list(na.rm = TRUE)) +
ylab(labely)
if (is.null(args$sc)) {
tp <- tp + stat_summary(fun = mean, fun.args = list(na.rm = TRUE),
geom = "line", colour = "black")
} else {
tp <- tp + stat_summary(fun = mean, fun.args = list(na.rm = TRUE),
geom = "line",
mapping = aes_string(colour = labelcolor),
show.legend = FALSE)
}
}
if (type == "names") {
dataplot$nb <- 1
sizewords <- 4
if (!is.null(args$size)) sizewords <- args$size
dataplot <- aggregate(data = dataplot, nb ~ values + SOMclustering, length)
tp <- ggplot(dataplot, aes_string(label = "values", size = "nb")) +
geom_text_wordcloud(stat = "identity", alpha = 0.7, size = sizewords) +
labs(subtitle = labely)
}
if (type == "words") {
dataplot <- aggregate(data = dataplot, values ~ variable + SOMclustering,
sum)
tp <- ggplot(dataplot, aes_string(label = "variable", size = "values")) +
geom_text_wordcloud(stat="identity", alpha=0.7) +
labs(subtitle = "sum of values by variable")
}
if (type == "pie") {
if (!is.null(args$varname)) labelcolor <- args$varname
dataplot$Nb <- 1
dataplot$Nbcluster <- 1
datatot <- aggregate(data = dataplot, Nbcluster ~ SOMclustering, sum)
dataplot <- aggregate(data = dataplot, Nb ~ SOMclustering + values, sum)
dataplot <- merge(dataplot, datatot, by="SOMclustering", all.x = TRUE)
labely <- "Number of observations in the cluster"
dataplot$Share <- dataplot$Nb/dataplot$Nbcluster
dataplot$Nbcluster <- sqrt(dataplot$Nbcluster)/pi
if (!args$proportional) {
labely <- ""
dataplot$Nbcluster <- max(dataplot$Nbcluster)
}
dataplot$halfNbcluster <- dataplot$Nbcluster/2
tp <- ggplot(dataplot,
aes_string(x = "halfNbcluster", y = "Share", fill = "values",
width = "Nbcluster")) +
geom_bar(position = "fill", stat = "identity") +
coord_polar("y") +
ylab(NULL) + xlab("Number of individuals in the cluster") +
guides(fill=guide_legend(title = labelcolor))
}
mylabels <- names[ordered.index]
names(mylabels) <- levels(dataplot$SOMclustering)
tp <- tp + facet_wrap(SOMclustering ~ .,
drop = FALSE,
nrow = the.grid$dim[2],
labeller = labeller(SOMclustering = mylabels),
dir = "h") +
ggtitle(myTitle(args, what)) +
theme_facet()
if (type == "pie"){
tp <- tp + theme(axis.text.x = element_blank(),
axis.title.y = element_blank(),
axis.text.y = element_blank(),
axis.ticks.y = element_blank())
}
if (!show.names){
tp <- tp + theme(strip.text = element_blank())
}
return(tp)
}
ggplotEnergy <- function(sommap) {
if (is.null(sommap$backup)) {
stop("no intermediate backups have been registered\n", call.=TRUE)
} else {
dataenergy <- data.frame("Steps" = sommap$backup$steps,
"Energy" = sommap$backup$energy)
p <- ggplot(dataenergy, aes_string(x = "Steps", y = "Energy")) +
geom_line() + geom_point() + ggtitle("Energy evolution") +
theme_bw()
p
}
} |
smsn.nl <- function(y, x = NULL, z = NULL, betas = NULL, sigma2 = NULL, shape = NULL, rho = NULL,
nu = NULL, nlf = NULL, rho.func = 1, reg.type = "Homoscedastic", criteria = FALSE,
family = "Skew.t", error = 0.00001, iter.max = 100){
if(ncol(as.matrix(y)) > 1) stop("Only univariate non linear regression supported!")
if( length(y) != nrow(as.matrix(x)) ) stop("X variable does not have the same number of lines than y")
if( (length(x) == 0) | (length(betas) == 0) | (length(sigma2) == 0) | (length(shape) == 0) ) stop("All parameters must be provided.")
if( !is.function(nlf) ) stop("nfl parameter must be a function!")
if( (family != "Skew.t") && (family != "t") && (family != "Skew.cn") && (family != "Skew.normal") && (family != "Normal") && (family != "Skew.slash"))
stop("Distribution family not supported. Check documentation!")
if( (family == "Normal") | (family == "Skew.normal"))
{
if(length(nu) != 0) stop("For the Skew.Normal and the Normal family the Nu parameters must not be provided.")
}
if( (family == "Skew.t") | (family == "t") | (family == "Skew.slash"))
{
if(length(nu) > 1) stop("Nu parameters must have only one parameter")
if(length(nu) == 0) stop("Nu parameters must be provided.")
if(nu <= 0) stop("Nu parameters must be positive.")
}
if(family == "Skew.cn")
{
if(length(nu) !=2) stop("For the Skew.cn nu must have 2 parameters")
if(nu[1] <=0 || nu[1] >= 1) stop("nu[1] must be in (0,1)")
if(nu[2] <=0 || nu[2] >= 1) stop("nu[2] must be in (0,1)")
}
if( (reg.type != "Homoscedastic") && (reg.type != "Ho") && (reg.type != "Heteroscedastic") && (reg.type != "He") )
stop("Regression type not supported")
if( (reg.type == "Homoscedastic") | (reg.type == "Ho") )
out <- smsn.nl.intern(y, x, betas, sigma2, shape, nu, nlf, criteria, family, error, iter.max)
if( (reg.type == "Heteroscedastic") | (reg.type == "He") ){
if( (length(z) == 0) | (length(rho) == 0) ) stop("All parameters must be provided.")
if((rho.func != 1) & (rho.func != 2)) stop("The non linear function for sigma can only have type 1 or 2. Check documentation!")
out <- smsn.nlh.intern(y, x, z, betas, sigma2, shape, rho, nu, nlf, rho.func, criteria, family, error, iter.max)
}
out
} |
ascii.integer <- function (x, include.rownames = FALSE, include.colnames = FALSE, rownames = NULL, colnames = NULL, format = "f", digits = 2, decimal.mark = ".", na.print = "", caption = NULL, caption.level = NULL, width = 0, frame = NULL, grid = NULL, valign = NULL, header = FALSE, footer = FALSE, align = NULL, col.width = 1, style = NULL, tgroup = NULL, n.tgroup = NULL, talign = "c", tvalign = "middle", tstyle = "h", bgroup = NULL, n.bgroup = NULL, balign = "c", bvalign = "middle", bstyle = "h", lgroup = NULL, n.lgroup = NULL, lalign = "c", lvalign = "middle", lstyle = "h", rgroup = NULL, n.rgroup = NULL, ralign = "c", rvalign = "middle", rstyle = "h", ...){
obj <- asciiTable$new(x = x, include.rownames = include.rownames,
include.colnames = include.colnames, rownames = rownames, colnames = colnames,
format = format, digits = digits, decimal.mark = decimal.mark, na.print = na.print,
caption = caption, caption.level = caption.level, width = width, frame = frame,
grid = grid, valign = valign, header = header, footer = footer, align = align,
col.width = col.width, style = style,
tgroup = tgroup, n.tgroup = n.tgroup, talign = talign,
tvalign = tvalign, tstyle = tstyle,
bgroup = bgroup, n.bgroup = n.bgroup, balign = balign,
bvalign = bvalign, bstyle = bstyle,
lgroup = lgroup, n.lgroup = n.lgroup, lalign = lalign,
lvalign = lvalign, lstyle = lstyle,
rgroup = rgroup, n.rgroup = n.rgroup, ralign = ralign,
rvalign = rvalign, rstyle = rstyle)
return(obj)
}
ascii.numeric <- function (x, include.rownames = FALSE, include.colnames = FALSE, rownames = NULL, colnames = NULL, format = "f", digits = 2, decimal.mark = ".", na.print = "", caption = NULL, caption.level = NULL, width = 0, frame = NULL, grid = NULL, valign = NULL, header = FALSE, footer = FALSE, align = NULL, col.width = 1, style = NULL, tgroup = NULL, n.tgroup = NULL, talign = "c", tvalign = "middle", tstyle = "h", bgroup = NULL, n.bgroup = NULL, balign = "c", bvalign = "middle", bstyle = "h", lgroup = NULL, n.lgroup = NULL, lalign = "c", lvalign = "middle", lstyle = "h", rgroup = NULL, n.rgroup = NULL, ralign = "c", rvalign = "middle", rstyle = "h", ...){
obj <- asciiTable$new(x = x, include.rownames = include.rownames,
include.colnames = include.colnames, rownames = rownames, colnames = colnames,
format = format, digits = digits, decimal.mark = decimal.mark, na.print = na.print,
caption = caption, caption.level = caption.level, width = width, frame = frame,
grid = grid, valign = valign, header = header, footer = footer, align = align,
col.width = col.width, style = style,
tgroup = tgroup, n.tgroup = n.tgroup, talign = talign,
tvalign = tvalign, tstyle = tstyle,
bgroup = bgroup, n.bgroup = n.bgroup, balign = balign,
bvalign = bvalign, bstyle = bstyle,
lgroup = lgroup, n.lgroup = n.lgroup, lalign = lalign,
lvalign = lvalign, lstyle = lstyle,
rgroup = rgroup, n.rgroup = n.rgroup, ralign = ralign,
rvalign = rvalign, rstyle = rstyle)
return(obj)
}
ascii.character <- function (x, include.rownames = FALSE, include.colnames = FALSE, rownames = NULL, colnames = NULL, format = "f", digits = 2, decimal.mark = ".", na.print = "", caption = NULL, caption.level = NULL, width = 0, frame = NULL, grid = NULL, valign = NULL, header = FALSE, footer = FALSE, align = NULL, col.width = 1, style = NULL, tgroup = NULL, n.tgroup = NULL, talign = "c", tvalign = "middle", tstyle = "h", bgroup = NULL, n.bgroup = NULL, balign = "c", bvalign = "middle", bstyle = "h", lgroup = NULL, n.lgroup = NULL, lalign = "c", lvalign = "middle", lstyle = "h", rgroup = NULL, n.rgroup = NULL, ralign = "c", rvalign = "middle", rstyle = "h", ...){
obj <- asciiTable$new(x = x, include.rownames = include.rownames,
include.colnames = include.colnames, rownames = rownames, colnames = colnames,
format = format, digits = digits, decimal.mark = decimal.mark, na.print = na.print,
caption = caption, caption.level = caption.level, width = width,
frame = frame, grid = grid, valign = valign, header = header, footer = footer,
align = align, col.width = col.width, style = style,
tgroup = tgroup, n.tgroup = n.tgroup, talign = talign,
tvalign = tvalign, tstyle = tstyle,
bgroup = bgroup, n.bgroup = n.bgroup, balign = balign,
bvalign = bvalign, bstyle = bstyle,
lgroup = lgroup, n.lgroup = n.lgroup, lalign = lalign,
lvalign = lvalign, lstyle = lstyle,
rgroup = rgroup, n.rgroup = n.rgroup, ralign = ralign,
rvalign = rvalign, rstyle = rstyle)
return(obj)
}
ascii.factor <- function (x, include.rownames = FALSE, include.colnames = FALSE, rownames = NULL, colnames = NULL, format = "f", digits = 2, decimal.mark = ".", na.print = "", caption = NULL, caption.level = NULL, width = 0, frame = NULL, grid = NULL, valign = NULL, header = FALSE, footer = FALSE, align = NULL, col.width = 1, style = NULL, tgroup = NULL, n.tgroup = NULL, talign = "c", tvalign = "middle", tstyle = "h", bgroup = NULL, n.bgroup = NULL, balign = "c", bvalign = "middle", bstyle = "h", lgroup = NULL, n.lgroup = NULL, lalign = "c", lvalign = "middle", lstyle = "h", rgroup = NULL, n.rgroup = NULL, ralign = "c", rvalign = "middle", rstyle = "h", ...){
obj <- asciiTable$new(x = x, include.rownames = include.rownames,
include.colnames = include.colnames, rownames = rownames, colnames = colnames,
format = format, digits = digits, decimal.mark = decimal.mark, na.print = na.print,
caption = caption, caption.level = caption.level, width = width, frame = frame,
grid = grid, valign = valign, header = header, footer = footer, align = align,
col.width = col.width, style = style,
tgroup = tgroup, n.tgroup = n.tgroup, talign = talign,
tvalign = tvalign, tstyle = tstyle,
bgroup = bgroup, n.bgroup = n.bgroup, balign = balign,
bvalign = bvalign, bstyle = bstyle,
lgroup = lgroup, n.lgroup = n.lgroup, lalign = lalign,
lvalign = lvalign, lstyle = lstyle,
rgroup = rgroup, n.rgroup = n.rgroup, ralign = ralign,
rvalign = rvalign, rstyle = rstyle)
return(obj)
}
ascii.proc_time = function(x, include.rownames=FALSE, include.colnames=TRUE, ...)
ascii(summary(x), include.rownames, include.colnames, ...) |
getAnalysis <- function(){
if (is.environment(APIinfo) &&
length(APIinfo$BEARER_TOKEN) > 0 &&
APIinfo$fileConfirmation == 'y'){
setupFetch <- tweetFetcher()
fetchedTweet <- tweetFetcher.fetch(setupFetch)
if (!is.null(fetchedTweet)) {
cleanedDocs <- cleanFetchedTweet(fetchedTweet)
clearPrevious()
getCloudSentiment(cleanedDocs)
getBarSentiment(cleanedDocs)
}
}else{
warning("First of use setAccount function correctly")
}
} |
context("polyarea")
test_that("ployarea computes the area of two identical squares", {
x <- c(1, 1, 3, 3, 1)
y <- c(1, 3, 3, 1, 1)
expect_that(polyarea(cbind(x, x), cbind(y, y)), equals(c(4, 4)))
expect_that(polyarea(cbind(x, x), cbind(y, y), 1), equals(c(4, 4)))
expect_that(polyarea(rbind(x, x), rbind(y, y), 2), equals(c(4, 4)))
}) |
rba_panther_mapping <- function(genes,
organism,
...) {
.rba_ext_args(...)
.rba_args(cons = list(list(arg = "genes",
class = c("character",
"numeric"),
max_len = 1000),
list(arg = "organism",
class = "numeric",
len = 1)))
.msg("Mapping %s input genes from organims %s to PANTHER databse.",
length(genes), organism)
call_body <- list(geneInputList = paste(genes, collapse = ","),
organism = organism)
parser_input <- list("json->list",
function(x) {list(unmapped_list = x$search$unmapped_list,
mapped_genes = x$search$mapped_genes)})
input_call <- .rba_httr(httr = "post",
url = .rba_stg("panther", "url"),
path = paste0(.rba_stg("panther", "pth"),
"geneinfo"),
encode = "form",
body = call_body,
accept = "application/json",
parser = parser_input,
save_to = .rba_file("rba_panther_mapping.json"))
final_output <- .rba_skeleton(input_call)
return(final_output)
}
rba_panther_enrich <- function(genes,
organism,
annot_dataset,
test_type = "FISHER",
correction = "FDR",
cutoff = NULL,
ref_genes = NULL,
ref_organism = NULL,
...) {
.rba_ext_args(...)
.rba_args(cons = list(list(arg = "genes",
class = c("character",
"numeric"),
max_len = 100000),
list(arg = "organism",
class = "numeric",
len = 1),
list(arg = "annot_dataset",
class = "character",
len = 1),
list(arg = "test_type",
class = "character",
val = c("FISHER", "BINOMIAL"),
len = 1),
list(arg = "correction",
class = "character",
val = c("FDR", "BONFERRONI", "NONE"),
len = 1),
list(arg = "cutoff",
class = "numeric",
len = 1,
ran = c(0, 1)),
list(arg = "ref_genes",
class = c("character",
"numeric"),
max_len = 100000),
list(arg = "ref_organism",
class = "numeric",
len = 1)),
cond = list(list(quote(!is.null(ref_organism) && is.null(ref_genes)),
"'ref_organism' was ignored because no 'ref_genes' was supplied.")),
cond_warning = TRUE)
.msg("Performing over-representation enrichment analysis of %s input genes of organism %s against %s datasets.",
length(genes), organism, annot_dataset)
call_body <- .rba_query(init = list(geneInputList = paste(genes,
collapse = ","),
organism = organism,
annotDataSet = annot_dataset,
enrichmentTestType = test_type,
correction = correction),
list("refInputList",
!all(is.null(ref_genes)),
paste(ref_genes, collapse = ",")),
list("refOrganism",
!is.null(ref_organism),
ref_organism))
parser_input <- list("json->list_simp",
function(x) {
x <- x$results
x$result$term_label <- x$result$term[, 1]
x$result$term <- x$result$term[, 2]
return(x)
})
if (!is.null(cutoff)) {
if (correction == "FDR") {
parser_input <- append(parser_input,
list(function(x) {
x$result <- x$result[which(x$result$fdr <= cutoff), ]
return(x)
}))
} else {
parser_input <- append(parser_input,
list(function(x) {
x$result <- x$result[which(x$result$pValue <= cutoff), ]
return(x)
}))
}
}
input_call <- .rba_httr(httr = "post",
url = .rba_stg("panther", "url"),
path = paste0(.rba_stg("panther", "pth"),
"enrich/overrep"),
encode = "form",
body = call_body,
accept = "application/json",
parser = parser_input,
save_to = .rba_file("rba_panther_enrich.json"))
final_output <- .rba_skeleton(input_call)
return(final_output)
}
rba_panther_info <- function(what,
organism_chr_loc = FALSE,
families_page = 1,
...) {
.rba_ext_args(...)
.rba_args(cons = list(list(arg = "what",
class = "character",
val = c("organisms",
"datasets",
"families",
"pathways")),
list(arg = "organism_chr_loc",
class = "logical",
len = 1),
list(arg = "families_page",
class = "numeric",
len = 1)),
cond = list(list(quote(families_page != 1 && what != "families"),
"'families_page' was ignored because 'what' argument is not 'families'.",
warn = TRUE),
list(quote(isTRUE(organism_chr_loc)),
"'organism_chr_loc' was ignored because 'what' argument is not 'organisms'.",
warn = TRUE)))
.msg("Retrieving %s%s.",
switch(what,
"organisms" = "supported organisms in PANTHER",
"datasets" = "available annotation datasets",
"families" = "available family IDs",
"pathways" = "available pathway IDs"),
ifelse(what == "families",
yes = sprintf(" (page %s)", families_page),
no = ""))
call_query <- .rba_query(init = list(),
list("type",
what == "organisms" && isTRUE(organism_chr_loc),
"chrLoc"),
list("startIndex",
what == "families",
(families_page - 1) * 1000 + 1))
switch(what,
"organisms" = {
path_input <- "supportedgenomes"
parser_input <- list("json->list_simp",
function(x) {x$search$output$genomes$genome})
},
"datasets" = {
path_input <- "supportedannotdatasets"
parser_input <- list("json->list_simp",
function(x) {x$search$annotation_data_sets$annotation_data_type})
},
"families" = {
path_input <- "supportedpantherfamilies"
parser_input <- list("json->list_simp",
function(x) {
y <- list(familiy = x$search$panther_family_subfam_list$family,
page = families_page,
pages_count = x$search$number_of_families %/% 1000
)
})
},
"pathways" = {
path_input <- "supportedpantherpathways"
parser_input <- list("json->list_simp",
function(x) {
x$search$output$PANTHER_pathway_list$pathway
})
})
input_call <- .rba_httr(httr = "get",
url = .rba_stg("panther", "url"),
path = paste0(.rba_stg("panther", "pth"),
path_input),
query = call_query,
accept = "application/json",
parser = parser_input,
save_to = .rba_file("panther_info.json"))
final_output <- .rba_skeleton(input_call)
return(final_output)
}
rba_panther_ortholog <- function(genes,
organism,
type = "all",
target_organisms = NULL,
seq_pos = NULL,
include_msa = NULL,
...) {
.rba_ext_args(...)
.rba_args(cons = list(list(arg = "genes",
class = c("character",
"numeric"),
max_len = 10),
list(arg = "organism",
class = "numeric",
len = 1),
list(arg = "type",
class = "character",
val = c("LDO",
"all"),
len = 1),
list(arg = "target_organisms",
class = "numeric"),
list(arg = "seq_pos",
class = "numeric",
len = 1),
list(arg = "include_msa",
class = "logical",
len = 1)),
cond = list(list(quote(!is.null(seq_pos) && length(genes) > 1),
"When 'seq_pos' is supplied, 'genes' argument should be a single input."),
list(quote(!is.null(include_msa) && is.null(seq_pos)),
"'include_msa' was ignored because no 'seq_pos' was supplied.",
warn = TRUE)))
.msg("Retrieving %s orthologs of genes %s.",
type, .paste2(genes, quote_all = "'"))
call_body <- .rba_query(init = list(organism = organism,
orthologType = type),
list("geneInputList",
is.null(seq_pos),
paste(genes, collapse = ",")),
list("gene",
!is.null(seq_pos),
genes),
list("targetOrganism",
!is.null(target_organisms),
paste(target_organisms, collapse = ",")),
list("pos",
!is.null(seq_pos),
seq_pos),
list("includeMsa",
!is.null(include_msa) && !is.null(seq_pos),
ifelse(isTRUE(include_msa),
yes = "true", no = "false"))
)
if (is.null(seq_pos)) {
path_input <- "matchortho"
} else {
path_input <- "homologpos"
}
parser_input <- list("json->list_simp",
function(x) {x$search$mapping$mapped})
input_call <- .rba_httr(httr = "post",
url = .rba_stg("panther", "url"),
path = paste0(.rba_stg("panther", "pth"),
"ortholog/", path_input),
encode = "form",
body = call_body,
accept = "application/json",
parser = parser_input,
save_to = .rba_file("rba_panther_ortholog.json"))
final_output <- .rba_skeleton(input_call)
return(final_output)
}
rba_panther_homolog <- function(genes,
organism,
type = "P",
target_organisms = NULL,
...) {
.rba_ext_args(...)
.rba_args(cons = list(list(arg = "genes",
class = c("character",
"numeric"),
max_len = 10),
list(arg = "organism",
class = "numeric",
len = 1),
list(arg = "type",
class = "character",
val = c("P",
"X",
"LDX"),
len = 1),
list(arg = "target_organisms",
class = "numeric")),
cond = list(list(quote(type == "P" && !is.null(target_organisms)),
"For Paralog, target organism and organism should be the same. thus, 'target_organisms' was ignored.",
warn = TRUE),
list(quote(type != "P" && !is.null(target_organisms) && organism %in% target_organisms),
"For horizontal gene transfers or least diverged horizontal gene transfers, the target organism should be different from the input organism")))
.msg("Retrieving %s homologs of genes %s.",
type, .paste2(genes, quote_all = "'"))
call_body <- .rba_query(init = list(geneInputList = paste(genes, collapse = ","),
organism = organism,
homologType = type),
list("targetOrganism",
!is.null(target_organisms),
paste(target_organisms, collapse = ","))
)
parser_input <- list("json->list_simp",
function(x) {x$search$mapping$mapped})
input_call <- .rba_httr(httr = "post",
url = .rba_stg("panther", "url"),
path = paste0(.rba_stg("panther", "pth"),
"ortholog/homologOther"),
encode = "form",
body = call_body,
accept = "application/json",
parser = parser_input,
save_to = .rba_file("rba_panther_homolog.json"))
final_output <- .rba_skeleton(input_call)
return(final_output)
}
rba_panther_family <- function(id,
what,
target_organisms = NULL,
...) {
.rba_ext_args(...)
.rba_args(cons = list(list(arg = "id",
class = "character",
len = 1),
list(arg = "what",
class = "character",
val = c("ortholog",
"msa",
"tree"),
len = 1),
list(arg = "target_organisms",
class = "numeric")))
.msg( "Retrieving %s information of PANTHER family %s.", what, id)
call_body <- .rba_query(init = list(family = id),
list("taxonFltr",
!is.null(target_organisms),
paste(target_organisms, collapse = ","))
)
switch(what,
"ortholog" = {
path_input <- "familyortholog"
parser_input <- list("json->list_simp",
function(x) {x$search$ortholog_list$ortholog})
},
"msa" = {
path_input <- "familymsa"
parser_input <- list("json->list_simp",
function(x) {x$search$MSA_list$sequence_info})},
"tree" = {
path_input <- "treeinfo"
parser_input <- list("json->list_simp",
function(x) {x$search$tree_topology})})
input_call <- .rba_httr(httr = "post",
url = .rba_stg("panther", "url"),
path = paste0(.rba_stg("panther", "pth"),
path_input),
encode = "form",
body = call_body,
accept = "application/json",
parser = parser_input,
save_to = .rba_file("rba_panther_family.json"))
final_output <- .rba_skeleton(input_call)
return(final_output)
}
rba_panther_tree_grafter <- function(protein_seq,
target_organisms = NULL,
...) {
.rba_ext_args(...)
.rba_args(cons = list(list(arg = "protein_seq",
class = "character",
len = 1),
list(arg = "target_organisms",
class = "numeric")),
cond = list(list(quote(nchar(protein_seq) > 5000),
"Maximum allowed length of protein sequence is 50kb.")))
.msg("Retrieving a PANTHER family tree with your input protein grated in it.")
call_body <- .rba_query(init = list(sequence = protein_seq),
list("taxonFltr",
!is.null(target_organisms),
paste(target_organisms, collapse = ","))
)
parser_input <- list("json->list_simp",
function(x) {x$search})
input_call <- .rba_httr(httr = "post",
url = .rba_stg("panther", "url"),
path = paste0(.rba_stg("panther", "pth"),
"graftsequence"),
encode = "form",
body = call_body,
accept = "application/json",
parser = parser_input,
save_to = .rba_file("rba_panther_tree_grafter.json"))
final_output <- .rba_skeleton(input_call)
return(final_output)
} |
read_egonet <- function(egos.file, alter.folder, edge.folder, csv.sep = ",",
ID.vars=list(ego="egoID", alter="alterID", source="Source", target="Target"),
first.col.row.names = FALSE, ...) {
IDv <- modifyList(eval(formals()$ID.vars), ID.vars)
if(first.col.row.names) {row.names <- 1} else {row.names <- NULL}
message("Reading ego data.")
egos <- read.csv(egos.file,
sep = csv.sep,
row.names = row.names)
message("Checking if alter.files and edge.files correspond")
alter.files <- list.files(alter.folder, full.names = TRUE)
alter_ego_ids <- map(alter.files, basename)
alter_ego_ids <- gsub("[^0-9]", "", alter_ego_ids)
edge.files <- list.files(edge.folder, full.names = TRUE)
edge_ego_ids <- map(edge.files, basename)
edge_ego_ids <- gsub("[^0-9]", "", edge_ego_ids)
message("Creating $alters.df and $alters.list")
names(alter.files) <- alter_ego_ids
alter.attr.df <-
purrr::map_dfr(alter.files,
read.csv, sep = csv.sep,
.id = "egoID") %>%
select(!!sym(IDv$alter), !!sym(IDv$ego), everything())
message("Creating edge lists: $edges")
names(edge.files) <- edge_ego_ids
aaties.df <-
purrr::map_dfr(edge.files,
read.csv, sep = csv.sep,
.id = "egoID")
egor(alter.attr.df, egos, aaties.df, ID.vars=IDv, ...)
} |
tar_git_init <- function(
store = targets::tar_config_get("store"),
stash_gitignore = TRUE,
git_lfs = TRUE,
verbose = TRUE
) {
tar_assert_file(store)
targets::tar_assert_lgl(verbose)
targets::tar_assert_scalar(verbose)
if (tar_git_repo_exists(store)) {
cli_info("Data store Git repository already exists.")
cli_info("Remove ", file.path(store, ".git"), " to start over.")
return(invisible())
}
if (stash_gitignore) {
tar_git_gitignore_restore(repo = store)
tar_git_gitignore_stash(repo = store)
on.exit(tar_git_gitignore_unstash(repo = store))
}
tar_git_init_repo(path = store)
cli_success("Created data store Git repository", verbose = verbose)
if (git_lfs) {
tar_git_init_lfs(repo = store, verbose = verbose)
}
tar_git_init_stub(repo = store, verbose = verbose)
tar_git_commit(message = "Stub commit", repo = store, spinner = FALSE)
cli_success("Created stub commit without data.", verbose = verbose)
cli_info(
"Run tar_git_snapshot() to put the data files under version control.",
verbose = verbose
)
invisible()
}
tar_git_init_lfs <- function(repo, verbose) {
gitattributes <- file.path(repo, ".gitattributes")
lines <- c(
"objects filter=lfs diff=lfs merge=lfs -text",
"objects/* filter=lfs diff=lfs merge=lfs -text",
"objects/** filter=lfs diff=lfs merge=lfs -text",
"objects/**/* filter=lfs diff=lfs merge=lfs -text"
)
write_new_lines(path = gitattributes, lines = lines)
cli_success(
"Wrote to ",
gitattributes,
" for git-lfs: {.url https://git-lfs.github.com}.",
verbose = verbose
)
tar_git_add(files = basename(gitattributes), repo = repo, spinner = FALSE)
}
tar_git_init_stub <- function(repo, verbose) {
tar_git_stub_write(repo = repo)
tar_git_add(
files = basename(tar_git_stub_path(repo)),
repo = repo,
spinner = FALSE
)
} |
mskopt<-function(Dep,Id,Time,m,n,data){
InD<-Dep
dat1<-data
cvstr1=c("independence","compound","markov","AR1","ToE","unstructured")
cat("\n Estimated parameters for minimum AIC value \n")
aIC<-c()
for(i in 1:length(cvstr1)){
aIC[i]<-mskall(data=dat1,cvstr=cvstr1[i],Dep=InD,Id=Id,Time=Time,m=m,n=n)$aic
}
d<-data.frame(cvstr1,aIC)
params<-mskall(data=dat1,cvstr=d$cvstr1[which.min(d$aIC)],Dep=InD,Id=Id,Time=Time,m=m,n=n)$coff
rslt<-list()
rslt$params<-params
rslt$cvs<-d$cvstr1[which.min(d$aIC)]
rslt$Aic<-d
rslt
} |
spec_meta_is_valid <- list(
is_valid_formals = function() {
expect_equal(names(formals(dbIsValid)), c("dbObj", "..."))
},
is_valid_connection = function(ctx) {
con <- connect(ctx)
expect_true(expect_visible(dbIsValid(con)))
expect_error(dbDisconnect(con), NA)
expect_false(expect_visible(dbIsValid(con)))
},
is_valid_stale_connection = function(ctx, invalid_con) {
expect_false(expect_visible(dbIsValid(invalid_con)))
},
is_valid_result_query = function(con) {
query <- trivial_query()
res <- dbSendQuery(con, query)
expect_true(expect_visible(dbIsValid(res)))
expect_error(dbFetch(res), NA)
expect_true(expect_visible(dbIsValid(res)))
dbClearResult(res)
expect_false(dbIsValid(res))
},
is_valid_result_statement = function(con, table_name) {
query <- paste0("CREATE TABLE ", table_name, " (a ", dbDataType(con, 1L), ")")
res <- dbSendStatement(con, query)
expect_true(expect_visible(dbIsValid(res)))
expect_error(dbGetRowsAffected(res), NA)
expect_true(expect_visible(dbIsValid(res)))
dbClearResult(res)
expect_false(dbIsValid(res))
},
NULL
) |
OSOAs_regular <- function(s, k, el=3, m=NULL, noptim.rounds=1, noptim.repeats=1,
optimize = TRUE, dmethod="manhattan", p=50){
mycall <- sys.call()
stopifnot(s %in% c(2,3,4,5,7,8,9,11,13,16,17,19,23,27,29,31,32,37))
stopifnot(el %in% c(2,3))
mmax <- (s^(k-1)-1)/(s-1)
if (is.null(m)){
m <- morig <- mmax
if (el==3) m <- morig <- 2*floor(m/2)
}else{
if (m > (s^(k-1)-1)/(s-1)) stop("m is too large")
morig <- m
if (el==3) {
if (m > 2*floor((s^(k-1)-1)/(2*(s-1)))) stop("m is too large in combination with el=3")
if (m%%2==1)
m <- m + 1
}
}
oa <- createSaturated(s, k-1)[,mmax:(mmax-m+1), drop=FALSE]
aus <- OSOAs(oa, el=el, m=morig,
noptim.rounds=noptim.rounds, noptim.repeats=noptim.repeats, optimize = optimize, dmethod=dmethod, p=p)
attr(aus, "call") <- mycall
aus
} |
sw_augment_columns <- function(ret, data, rename_index, timetk_idx = FALSE) {
ret_1 <- data
ret_2 <- ret
if (is.null(ret_1)) {
if(!validate_index(ret_2, rename_index)) {
ret <- add_index(ret_2, rename_index)
} else {
ret <- ret_2
}
} else {
if (is.data.frame(ret_1)) {
idx <- tk_get_timeseries_variables(ret_1)[[1]]
if (length(idx) == 0) {
ret_1 <- add_index(ret_1, rename_index)
}
} else {
ret_1 <- tk_tbl(ret_1, rename_index = rename_index, silent = TRUE)
if (!validate_index(ret_1, rename_index)) {
ret_1 <- add_index(ret_1, rename_index)
}
}
if (nrow(ret_1) != nrow(ret_2)) {
warning("Incompatible structure. Returning .actual, .fitted and .residuals only.")
return(ret_2)
}
if (validate_index(ret_2, rename_index)) {
ret_2 <- ret_2 %>%
dplyr::select(-1)
}
if (".actual" %in% colnames(ret_2)) {
ret_2 <- ret_2 %>%
dplyr::select(-.actual)
}
ret <- dplyr::bind_cols(ret_1, ret_2)
}
if (!is.null(data)) {
if (timetk_idx) {
if (timetk::has_timetk_idx(data)) {
idx_name <- timetk::tk_get_timeseries_variables(ret)[[1]]
idx <- timetk::tk_index(data, timetk_idx = TRUE)
ret[,idx_name] <- idx
} else {
warning("`data` does not have a timetk index.")
}
}
}
return(ret)
}
validate_index <- function(ret, rename_index) {
ret_has_index <- rename_index %in% colnames(ret)
return(ret_has_index)
}
add_index <- function(ret, rename_index) {
ret_auto_index <- 1:nrow(ret)
ret <- ret %>%
tibble::add_column(..index = ret_auto_index)
colnames(ret)[[ncol(ret)]] <- rename_index
ret <- ret %>%
dplyr::select_(rename_index, "dplyr::everything()")
return(ret)
}
dplyr::`%>%`
finish_glance <- function(ret, x) {
ret$logLik <- tryCatch(as.numeric(stats::logLik(x)), error = function(e) NULL)
ret$AIC <- tryCatch(stats::AIC(x), error = function(e) NULL)
ret$BIC <- tryCatch(stats::BIC(x), error = function(e) NULL)
if (inherits(x, "lmerMod")) {
ret$deviance <- tryCatch(stats::deviance(x, REML = FALSE),
error = function(e) NULL
)
} else {
ret$deviance <- tryCatch(stats::deviance(x), error = function(e) NULL)
}
ret$df.residual <- tryCatch(stats::df.residual(x), error = function(e) NULL)
tibble::as_tibble(ret, rownames = NULL)
} |
test_that("trigger all", {
N = 10L
truth = 1 + runif(N)
response = 1 + runif(N)
tol = sqrt(.Machine$double.eps)
for (m in as.list(measures)) {
if (m$type != "regr") {
next
}
f = match.fun(m$id)
perf = f(truth = truth, response = response)
expect_number(perf, na.ok = FALSE, lower = m$lower - tol, upper = m$upper + tol, label = m$id)
if ("sample_weights" %in% names(formals(f))) {
sample_weights = runif(length(truth))
perf = f(truth = truth, response = response, sample_weights = sample_weights)
expect_number(perf, na.ok = FALSE, lower = m$lower - tol, upper = m$upper + tol, label = m$id)
}
}
})
test_that("tests from Metrics", {
expect_equal(bias(1, 1), 0)
expect_equal(bias(c(-1, -100, 17.5), c(0, 0, 0)), mean(c(-1, -100, 17.5)))
expect_equal(pbias(c(1, 2, 3), c(1, 3, 2)), mean(c(0, -1 / 2, 1 / 3)))
expect_equal(pbias(c(1, 2, 0), c(1, 2, 1)), NaN)
expect_equal(pbias(0, 0), NaN)
expect_equal(pbias(c(-1.1, 1.1), c(-1, 1)), 0)
expect_equal(se(3.4, 4.4), 1)
expect_equal(se(9:11, 11:9), c(4, 0, 4))
expect_equal(sse(c(1, 3, 2), c(2, 3, 4)), 5)
expect_equal(mse(1:4, c(2, 3, 4, 4)), 3 / 4)
expect_equal(rmse(1:4, c(1, 2, 3, 5)), sqrt(1 / 4))
expect_equal(rmse(1:4, 1:4), 0)
expect_equal(ae(3.4, 4.4), 1)
expect_equal(ae(9:11, 11:9), c(2, 0, 2))
expect_equal(mae(1:4, c(1, 2, 3, 5)), 0.25)
expect_equal(medae(1:4, c(1, 2, 4, 50)), 0.5)
expect_equal(ape(0:3, 1:4), c(Inf, 1, 1 / 2, 1 / 3))
expect_equal(ape(0:2, c(0, 0, 0)), c(NaN, 1, 1))
expect_equal(ape(c(-1.1, 1.1), c(-1, 1)), c(1 / 11, 1 / 11))
expect_equal(mape(1:3, 2:4), mean(c(1, 1 / 2, 1 / 3)))
expect_equal(mape(c(-1.1, 1.1), c(-1, 1)), 1 / 11)
expect_equal(smape(0, 0), NaN)
expect_equal(smape(1, -1), 2)
expect_equal(smape(1, 0), 2)
expect_equal(smape(c(1, 2, 3), c(2, 5, 4)), smape(c(2, 5, 4), c(1, 2, 3)))
expect_equal(sle(c(0, 1, 3.4), c(1, 0, 3.4)), c(log(2), log(2), 0)^2)
expect_equal(sle(exp(2) - 1, exp(1) - 1), 1)
expect_equal(msle(c(1, 2, exp(1) - 1), c(1, 2, exp(2) - 1)), 1 / 3)
expect_equal(rmsle(c(exp(5) - 1), c(exp(1) - 1)), 4)
expect_equal(rae(0:10, 30:40), 11)
expect_equal(rae(seq(0, 2, 0.5), seq(0, 2, 0.5)), 0.0)
expect_equal(rae(1:4, c(1, 2, 3, 5)), 0.25)
expect_equal(rrse(0:10, 2:12), sqrt(0.4))
expect_equal(rrse(seq(0, 2, 0.5), seq(0, 2, 0.5)), 0.0)
expect_equal(rrse(1:4, c(1, 2, 3, 5)), sqrt(0.2))
expect_equal(rse(0:10, 2:12), 0.4)
expect_equal(rse(seq(0, 2, 0.5), seq(0, 2, 0.5)), 0.0)
expect_equal(rse(1:4, c(1, 2, 3, 5)), 0.2)
expect_equal(rsq(0:10, 2:12), 0.6)
expect_equal(rsq(seq(0, 2, 0.5), seq(0, 2, 0.5)), 1.0)
expect_equal(rsq(1:4, c(1, 2, 3, 5)), 0.8)
}) |
lmatPairwise <- function(x, ...)
UseMethod("lmatPairwise")
lmatPairwise.matrix <- function(x, levels, ...) {
LA <- x[,-1]
LB <- cbind(-apply(LA, 1, sum), LA)
dimnames(LB)[[2]] <- levels
t(LB)
}
lmatPairwise.glht <- function(x, ...) {
if (is.null(x$type) || x$type != "Tukey")
stop("lmatPairwise requires glht with 'Tukey' pairwise contrasts",
call.=FALSE)
lmatPairwise.matrix(x=x$linfct,
levels=x$model$xlevels[[1]], ...)
}
lmatPairwise.mmc.multicomp <- function(x, ...)
lmatPairwise.glht(x=x$mca$glht, ...)
lmatPairwise.mmc <- lmatPairwise.mmc.multicomp |
run.mean <-
function(x,window)
{
{
a<-(window+1)/2
b<-length(x)-a+1
n<-(window-1)/2
y<-c(a:b)
ns<-matrix(nrow=length(y),ncol=2)
for(i in 1:length(y)){
ns[i,1]<-i
ns[i,2]<-i+2*n
mean(x[c(ns[i,1]:ns[i,2])])->y[i]
}
}
return(y)
} |
setOldClass("XMLNodeSet")
DefaultXPathNamespaces =
c(r = "http://www.r-project.org",
s = "http://cm.bell-labs.com/stat/S4",
omg = "http://www.omegahat.net",
mlb = "http://www.mathworks.com",
sh="http://www.shell.org",
perl = "http://www.perl.org",
py = "http://www.python.org",
fo="http://www.w3.org/1999/XSL/Format",
xsl="http://www.w3.org/1999/XSL/Transform",
xi="http://www.w3.org/2001/XInclude"
)
DefaultXMLSourceXPath =
sprintf("%s[not(@eval='false') and not(ancestor::ignore) and not(ancestor::section[@r:eval = 'false'])]",
c("//r:init", "//r:function", "//r:init", "//r:code", "//r:plot", "//r:expr"))
setGeneric("xmlSource",
function(url, ...,
envir = globalenv(),
xpath = character(),
ids = character(),
omit = character(),
ask = FALSE,
example = NA,
fatal = TRUE, verbose = TRUE, echo = verbose, print = echo,
xnodes = DefaultXMLSourceXPath,
namespaces = DefaultXPathNamespaces, section = character(), eval = TRUE, init = TRUE,
setNodeNames = FALSE, parse = TRUE, force = FALSE)
{
standardGeneric("xmlSource")
})
setMethod("xmlSource", c("character"),
function(url, ...,
envir =globalenv(),
xpath = character(),
ids = character(),
omit = character(),
ask = FALSE,
example = NA,
fatal = TRUE, verbose = TRUE, echo = verbose, print = echo,
xnodes = DefaultXMLSourceXPath,
namespaces = DefaultXPathNamespaces,
section = character(), eval = TRUE, init = TRUE, setNodeNames = FALSE, parse = TRUE, force = FALSE)
{
doc = xmlTreeParse(url, ..., useInternalNodes = TRUE)
xmlSource(doc, ..., envir = envir, xpath = xpath, ids = ids, omit = omit,
ask = ask, example = example, fatal = fatal, verbose = verbose,
print = print, xnodes = xnodes, namespaces = namespaces,
section = section, eval = eval, init = init, setNodeNames = setNodeNames, parse = parse, force = force)
})
setMethod("xmlSource", c("XMLInternalDocument"),
function(url, ...,
envir =globalenv(),
xpath = character(),
ids = character(),
omit = character(),
ask = FALSE,
example = NA,
fatal = TRUE, verbose = TRUE, echo = verbose, print = echo,
xnodes = DefaultXMLSourceXPath,
namespaces = DefaultXPathNamespaces,
section = character(), eval = TRUE, init = TRUE, setNodeNames = FALSE, parse = TRUE, force = FALSE)
{
doc = url
if(inherits(verbose, "numeric"))
verbose = verbose - 1
if(!is.character(section))
section = as.integer(section)
if(length(example) && !all(is.na(example))) {
egs = getNodeSet(doc, "//r:example", namespaces)
if(length(egs)) {
ids = sapply(egs, xmlGetAttr, "id")
if(length(example) == 1 && is.na(example)) {
cat("Select an example\n")
example = ids[w <- menu(ids)]
}
if(inherits(example, "numeric")) {
i = example
} else {
i = pmatch(example, ids)
if(all(is.na(i)))
stop("no example named ", example)
}
init = getNodeSet(doc, "//r:init[not(ancestor::r:example)]",
c(r = "http://www.r-project.org"))
if(length(init)) {
xmlSource(init, envir = envir, omit = omit, verbose = verbose, namespaces = namespaces, eval = eval, force = force)
cat("Done doc-level init", length(init), "\n")
}
ans = sapply(i, function(x) {
nodes = getNodeSet(egs[[x]], paste(xnodes, collapse = "|"), namespaces)
if(verbose)
cat("Example", ids[x], "\n")
xmlSource(nodes, envir = envir, omit = omit, verbose = verbose, namespaces = namespaces, eval = eval, setNodeNames = setNodeNames, parse = parse, force = force)
})
return(ans)
}
}
if(length(xpath)) {
if(length(section)) {
xpath =paste("//section[", section, "]", xpath, sep = "")
}
nodes = getNodeSet(doc, xpath, namespaces)
v =
unlist(lapply(nodes, function(n) {
unlist(lapply(xnodes,
function(p)
getNodeSet(n, p, namespaces)),
recursive = FALSE)
}), recursive = FALSE)
} else {
functions = limitXPathToSection(section, "//r:function[not(@eval = 'false') and not(ancestor::ignore)]")
xnodes = limitXPathToSection(section, xnodes)
v = getNodeSet(doc, paste(c(functions, xnodes), collapse = "|"), namespaces)
}
if(is.null(v))
stop("No matching nodes in the document found")
class(v) <- "XMLNodeSet"
if(missing(ids) && missing(xnodes) && length(ids <- getNodeSet(doc, "/*/r:codeIds|/*/invisible/r:codeIds",
namespaces = c(r = "http://www.r-project.org")))) {
if(length(ids) > 1) {
warning("more than one r:codeIds node. Using the first one")
}
ids = strsplit(xmlValue(ids[[1]]), "\\\n")[[1]]
ids = unique(ids)
ids = ids[ids != ""]
}
xmlSource(v, ids = ids, omit = omit, ask = ask, fatal = fatal, verbose = verbose, envir = envir,
section = if(!is.character(section)) section else character(),
eval = eval, setNodeNames = setNodeNames, parse = parse, force = force)
})
limitXPathToSection =
function(section, xpath = c("//r:code", "//r:func", "//r:plot", "//r:expr"))
{
if(length(section) == 0)
return(paste(xpath, collapse = "|"))
if(is.character(section))
section = paste("@id=", sQuote(section), sep = "")
paste(outer(section, xpath,
function(sect, xp)
paste("//section[", sect, "]", xp, sep = "")),
collapse = "|")
}
setMethod("xmlSource", "XMLNodeSet",
function(url, ..., envir =globalenv(),
xpath = character(),
ids = character(),
omit = character(),
ask = FALSE,
example = NA,
fatal = TRUE, verbose = TRUE, echo = verbose, print = echo,
xnodes = c("r:function[not(@val='false')]", "r:init[not(@eval='false')]", "r:code[not(@eval='false')]", "//r:plot[not(@eval='false')]"),
namespaces = DefaultXPathNamespaces, section = character(), eval = TRUE, init = TRUE, setNodeNames = FALSE, parse = TRUE, force = FALSE)
{
if(ask) {
doc = as(url[[1]], "XMLInternalDocument")
v = getNodeSet(doc, "//r:function|//r:init|//r:code|//r:plot", namespaces)
funs = sapply(v, xmlName) == "function"
if(any(funs)) {
}
}
ans = sapply(url, evalNode, envir = envir, verbose = verbose, ids = ids,
omit = omit, echo = echo, print = print, ask = ask, eval = eval, parse = parse, force = force)
if(setNodeNames)
names(ans) = sapply(url, getRCodeNodeName)
else
names(ans) = sapply(url, getNodePosition)
invisible(ans)
})
evalNode =
function(node, envir = globalenv(), ids = character(), verbose = FALSE, echo = verbose, omit = character(),
namespaces = c(r = "http://www.r-project.org"), print = echo, ask = FALSE, eval = TRUE, parse = TRUE, force = FALSE)
{
if(!force && (xmlName(xmlParent(node)) == "ignore" ||
length(getNodeSet(node, "./ancestor::section[@r:eval='false']|./ancestor::para[@r:eval='false']",
c(r = "http://www.r-project.org"))) > 0))
return(FALSE)
tmp = xmlGetAttr(node, "id", NA)
if(is.na(tmp) && length(ids) > 0 && !("" %in% ids))
return()
if(!is.na(tmp)) {
if(length(omit) > 0 && tmp %in% omit) {
if(verbose)
warning("skipping id ", tmp)
return()
} else if(length(ids) > 0 && !(tmp %in% ids)) {
if(verbose)
warning("ignoring id ", tmp)
return()
}
}
tmp = xmlGetAttr(node, "ignore", NA, converter = as.logical)
if(!is.na(tmp) && tmp) {
if(verbose)
warning("ignoring node", as(node, "character"))
return()
}
txt = paste(getRCode(node, namespaces), collapse = "\n")
if(!parse)
return(txt)
if(verbose)
cat("*************\nEvaluating node\n")
cmd = parse(text = txt)
if(echo)
print(cmd)
if(eval) {
if(ask) {
w = utils::menu(c("evaluate", "skip", "terminate"))
if(w == 2)
return(NULL)
else if(w == 3)
stop("User terminated the xmlSource")
}
isPlot = xmlName(node) == "plot"
if(isPlot) {
f = xmlGetAttr(node, "img")
if(!is.null(f)) {
attrs = xmlAttrs(node)
dev = openDevice(f, attrs)
}
if(!xmlGetAttr(node, "continuePlot", FALSE, as.logical))
on.exit(dev.off())
}
ans = eval(cmd, envir)
if(isPlot && inherits(ans, "trellis"))
print(ans)
ans
} else
cmd
}
openDevice =
function(f, attrs)
{
if("format" %in% names(attrs))
ext = attrs["format"]
else
ext = getExtension(f)
fun = switch(ext, png = png, jpeg = jpeg, pdf = pdf)
args = lapply(c("width", "height"), getDevAttr, attrs, fun, as.numeric)
cat("opening device for", f, "\n")
fun(f)
}
getDevAttr =
function(name, attrs, devFun, converter = as.character)
{
if(name %in% names(attrs))
converter(attrs[[name]])
else if(name %in% names(formals(devFun)))
formals(devFun)[[name]]
else
converter(NA)
}
getExtension =
function(f)
{
gsub(".*\\.", "", basename(f))
}
getRCode =
function(node, namespaces = c(r = "http://www.r-project.org"), recursive = TRUE,
dropOutput = FALSE)
{
tmp = xmlSApply(node, function(x) {
if(inherits(x, c("XMLInternalCommentNode", "XMLInternalPINode"))) {
} else if(inherits(x, "XMLInternalElementNode") && xmlName(x, full = TRUE) %in% c("r:code", "r:frag")) {
ref = xmlGetAttr(x, "ref", NA)
if(!is.na(ref)) {
v = getNodeSet(as(x, "XMLInternalDocument"),
paste(sapply(c("code", "frag"),
function(x) paste("//r:", x , "[@id='", ref, "']", sep = "")), collapse = "|"),
namespaces)
if(length(v) == 0)
stop("No code block/fragment named ", ref)
else if(length(v) > 1)
stop("More than 1 code block/fragment named ", ref)
else
if(recursive)
getRCode(v[[1]], namespaces, recursive = TRUE, dropOutput = dropOutput)
else
xmlValue(v[[1]])
} else {
if(recursive)
getRCode(x, namespaces, recursive = TRUE, dropOutput = dropOutput)
else
xmlValue(x)
}
} else if(inherits(x, "XMLInternalElementNode") && xmlName(x, full = TRUE) %in% c("r:error", "r:output")) {
} else
xmlValue(x)
})
if(dropOutput && length(names(tmp)))
tmp = tmp[names(tmp) != "output"]
paste(tmp, collapse = "\n")
}
setClass("XMLCodeFile", contains = "character")
setClass("XMLCodeDoc", contains = "XMLInternalDocument")
setAs("XMLCodeFile", "XMLCodeDoc",
function(from) {
new("XMLCodeDoc", xmlParse(from))
})
setAs("character", "XMLCodeFile",
function(from) {
xmlCodeFile(from)
})
setAs("character", "XMLCodeDoc",
function(from) {
xmlCodeFile(from, TRUE)
})
xmlCodeFile =
function(f, parse = FALSE)
{
if(parse)
new("XMLCodeDoc", xmlParse(f))
else
new("XMLCodeFile", f)
}
utils::globalVariables("use_file")
tmp.source =
function (file, local = FALSE, echo = verbose, print.eval = echo,
verbose = getOption("verbose"), prompt.echo = getOption("prompt"),
max.deparse.length = 150, chdir = FALSE, encoding = getOption("encoding"),
continue.echo = getOption("continue"), skip.echo = 0,
keep.source = getOption("keep.source"))
{
if(length(verbose) == 0)
verbose = FALSE
if(chdir) {
cwd = getwd()
on.exit(setwd(cwd))
setwd(dirname(file))
}
xmlSource(file, verbose = verbose)
}
setMethod("source", "XMLCodeFile", tmp.source)
setMethod("[[", "XMLCodeFile",
function(x, i, j, ..., env = globalenv()) {
doc = as(x, "XMLCodeDoc")
n = getNodeSet(doc, paste("//*[@id=", sQuote(i), "]"))
if(length(n) == 0) {
doc = updateIds(doc)
}
eval(parse(text = xmlValue(n[[1]])), envir = env)
})
updateIds =
function(doc, ...)
{
nodes = getNodeSet(doc,
"//r:function[not(@id) and not(@eval = 'false')]|//r:code[not(@id) and not(@eval = 'false')]",
c("r" = "http://www.r-project.org"))
sapply(nodes, getCodeVar)
}
getCodeVar =
function(node)
{
e = parse(text = getRCode(node))
e = e[[length(e)]]
id = if(class(e) %in% c("=", "<-"))
as.character(e[[2]])
else
NA
if(!is.na(id))
addAttributes(node, id = id)
id
}
setGeneric("xmlSourceFunctions",
function(doc, ids = character(), parse = TRUE, ...) {
standardGeneric("xmlSourceFunctions")
})
setMethod("xmlSourceFunctions", "character",
function(doc, ids = character(), parse = TRUE, ...)
{
invisible(xmlSourceFunctions(xmlParse(doc), ids, parse = parse, ...))
})
sQuote =
function(x)
sprintf("'%s'", as.character(x))
setMethod("xmlSourceFunctions", "XMLInternalDocument",
function(doc, ids = character(), parse = TRUE, setNodeNames = FALSE, ...)
{
if(length(ids))
nodes = getNodeSet(doc, paste("//r:function[", paste("@id", sQuote(ids), sep = "=", collapse = " or " ), "]"), c(r = "http://www.r-project.org"))
else
nodes = getNodeSet(doc, "//r:function[not(ancestor-or-self::*/@eval = 'false')]", c(r = "http://www.r-project.org"))
if(parse == FALSE)
return(nodes)
ans = xmlSource(nodes, ...)
if(setNodeNames)
names(ans) = sapply(nodes, getRCodeNodeName)
invisible(ans)
})
getRCodeNodeName =
function(node)
{
xmlGetAttr(node, "name", xmlGetAttr(node, "idx", getTaskId(node)))
}
setGeneric("xmlSourceSection",
function(doc, ids = character(),
xnodes = c(".//r:function", ".//r:init[not(@eval='false')]", ".//r:code[not(@eval='false')]", ".//r:plot[not(@eval='false')]"), namespaces = DefaultXPathNamespaces, ...)
standardGeneric("xmlSourceSection"))
setMethod("xmlSourceSection", "character",
function(doc, ids = character(), xnodes = c(".//r:function", ".//r:init[not(@eval='false')]", ".//r:code[not(@eval='false')]", ".//r:plot[not(@eval='false')]"), namespaces = DefaultXPathNamespaces, ...)
xmlSourceSection(xmlParse(doc), ids, xnodes, namespaces, ...))
setMethod("xmlSourceSection", "XMLInternalDocument",
function(doc, ids = character(),
xnodes = c(".//r:function", ".//r:init[not(@eval='false')]", ".//r:code[not(@eval='false')]", ".//r:plot[not(@eval='false')]"),
namespaces = DefaultXPathNamespaces, ...) {
nodes = getNodeSet(doc, "//section")
aids = sapply(nodes, xmlGetAttr, "id", NA)
m = pmatch(ids, aids)
if(any(is.na(m))) {
i = which(is.na(m))
tmp = ids[i]
j = pmatch(ids[i], sapply(nodes, function(x) {
tmp = getNodeSet(x, "./title")
if(length(tmp))
xmlValue(tmp[[1]])
else
""
}))
m[i [!is.na(j)]] = j[!is.na(j)]
}
if(any(is.na(m)))
stop("cannot match section id or title for ", paste(m[is.na(m)], collapse = ", "))
lapply(nodes[m], evalSection, xnodes, namespaces, ...)
})
evalSection =
function(node, xnodes, namespaces = DefaultXPathNamespaces, envir = globalenv(), ...)
{
if(xmlName(node, TRUE) %in% c("r:function", "r:plot", "r:code", "r:graphics"))
return(evalNode(node, envir, ...))
xpath = paste(xnodes, collapse = "|")
nodes = getNodeSet(node, xpath, namespaces)
sapply(nodes, evalNode, envir, ...)
}
setGeneric("xmlSourceThread",
function(doc, id, envir = globalenv(), ...,
xnodes = c("r:function", "r:init", "r:code", "r:plot"))
standardGeneric("xmlSourceThread"))
setMethod("xmlSourceThread", "character",
function(doc, id, envir = globalenv(), ...,
xnodes = c("r:function", "r:init", "r:code", "r:plot"))
xmlSourceThread(xmlParse(doc), id, envir, ..., xnodes = xnodes)
)
setMethod("xmlSourceThread", "list",
function(doc, id, envir = globalenv(), ...,
xnodes = c("r:function", "r:init", "r:code", "r:plot"))
sapply(doc, evalNode, envir = envir, ..., xnodes = xnodes))
if(FALSE)
setMethod("xmlSourceThread", "XMLNodeList",
function(doc, id, envir = globalenv(), ...,
xnodes = c(".//r:function", ".//r:init[not(@eval='false')]", ".//r:code[not(@eval='false')]", ".//r:plot[not(@eval='false')]"))
sapply(doc, evalNode, envir = envir, ...))
setMethod("xmlSourceThread", "XMLInternalDocument",
function(doc, id, envir = globalenv(), ...,
xnodes = c("r:function", "r:init", "r:code", "r:plot")) {
xp = sprintf("//*[@thread='%s']", id)
anc = sprintf("//%s[not(ancestor::*[@thread]) and not(ancestor::altApproach)]", xnodes)
xp = paste(c(xp, anc), collapse = " | ")
nodes = getNodeSet(doc, xp)
sapply(nodes, evalSection, envir = envir, ..., xnodes = xnodes)
})
setGeneric("xmlSourceTask",
function(doc, id, envir = globalenv(), ...) {
standardGeneric("xmlSourceTask")
}
)
xmlToCode = tangle =
function(doc, file = stdout())
{
e = xmlSourceFunctions(doc, eval = FALSE)
if(!is(file, "connection"))
con = file(file, "w")
sapply(e, function(x) cat(x, "\n", file = file))
file
}
getTaskId =
function(node) {
els = getNodeSet(node, ".//ancestor::task")
if(length(els))
xmlGetAttr(els[[1]], "id")
else
""
} |
"magic_testdata" |
wclim <-
function (f = 1:19, full = F)
{
bio <- {
}
for (i in 1:9) {
bio[i] <- paste("BIO0", i, sep = "")
}
for (i in 10:19) {
bio[i] <- paste("BIO", i, sep = "")
}
abbrev <- c("AMT", "MDR", "I", "TS", "MTWM", "MTCM", "TAR",
"MTWeQ", "MTDQ", "MTWQ", "MTCQ", "AP", "PWeM", "PDM",
"PS", "PWeQ", "PDQ", "PWQ", "PCQ")
name <- c("Annual Mean Temperature", "Mean Diurnal Range",
"Isothermality", "Temperature seasonality", "Max Temperature of Warmest Month",
"Min Temperature of Coldest Month", "Temperature Annual Range",
"Mean Temperature of Wettest Quarter", "Mean Temperature of Driest Quarter",
"Mean Temperature of Warmest Quarter", "Mean Temperature of Coldest Quarter",
"Annual Precipitation", "Precipitation of Wettest Month",
"Precipitation of Driest Month", "Precipitation Seasonality",
"Precipitation of Wettest Quarter", "Precipitation of Driest Quarter",
"Precipitation of Warmest Quarter", "Precipitation of Coldest Quarter")
correction <- c(rep(10, 11), rep(1, 8))
wclim <- data.frame(bio, abbrev, name, correction, stringsAsFactors = F)
if (full == T) {
wcm <- wclim[f, ]
}
else {
wcm <- wclim$name[f]
}
return(wcm)
} |
ZoonCitation <- function(ModuleName) {
ModuleRepo <- "https://raw.githubusercontent.com/zoonproject/modules"
ModuleURL <- paste0(ModuleRepo, "/master/R/", ModuleName, ".R")
if (!RCurl::url.exists(ModuleURL))
stop("URL for module does not exist: ", ModuleURL)
ModBlocks <- ZoonModuleParse(ModuleURL)
section_idx <- grepl("section", names(ModBlocks))
version_idx <- grepl("^Version: ", ModBlocks[section_idx])
submitted_idx <- grepl("^Date submitted", ModBlocks[section_idx])
version <- ModBlocks[section_idx][version_idx]
title <- ModBlocks$title
name <- ModBlocks$name
authors <- gsub(", \\\\email\\{.+\\}", "", ModBlocks$author)
date_section <- ModBlocks[section_idx][submitted_idx]
date_submitted <- as.Date(gsub("^Date submitted: ", "", date_section))
note <- paste("Zoon module", tolower(version))
url <- ModuleURL
email_index <- gregexpr("\\\\email\\{.+\\}", ModBlocks$author)[[1]]
email <- substr(ModBlocks$author,
email_index[1] + 7,
email_index[1] + attr(email_index, "match.length") - 2)
citation <- list(
title = title,
name = name,
authors = authors,
date_submitted = date_submitted,
note = note,
email = email,
url = url
)
class(citation) <- "zoonCitation"
return(citation)
} |
xgboard.eval.error <- function(preds, dtrain, dump) {
y_true <- getinfo(dtrain, "label")
DT <- data.table(y_true = y_true, y_prob = preds, key = "y_prob")
cleaner <- !duplicated(DT[, "y_prob"], fromLast = TRUE)
lens <- length(y_true)
nump <- sum(y_true)
DT[, tn_v := cumsum(y_true == 0)]
DT[, tp_v := nump - cumsum(y_true == 1)]
DT <- DT[cleaner, ]
DT[, acc := (tn_v + tp_v) / lens]
best <- which.max(DT$acc)[1]
metric <- c(DT$acc[best], DT$y_prob[best])
xgboard.dump(metric, dump)
return(list(metric = "error", value = metric[1]))
} |
lr_pos<-function(Cell1, Cell2, Cell3, Cell4)
{Prev<-(Cell1+Cell4)
Prev0<-(Cell2+Cell3)
Sens<-(Cell1/Prev)
Spec<-(Cell4/Prev0)
LikRatPos<-(Sens/(1-Spec))
LikRatPosSE<-1.96*sqrt(((1/Cell1)+(1/Prev)+(1/Cell2)+(1/Prev0)))
lnLikRatPos<-log(LikRatPos)
LikRatPos95Lower<-(lnLikRatPos-LikRatPosSE)
LikRatPos95Upper<-(lnLikRatPos+LikRatPosSE)
message(paste('Likelihood Ratio Positive =',(LikRatPos)))
message(paste('95% Lower Bound =',(exp(LikRatPos95Lower))))
message(paste('95% Upper Bound =',(exp(LikRatPos95Upper))))} |
test_that("multiseq", {
v <- c("a", "a", "a", "c", "b", "b" , "a")
vF <- factor(c("a", "a", "a", "c", "b", "b" , "a"))
n <- c(1, 1, 2, 4, 1)
expect_equal(multiseq(v), c(1, 2, 3, 1, 1, 2, 4))
expect_equal(multiseq(vF), c(1, 2, 3, 1, 1, 2, 4))
expect_equal(multiseq(n), c(1, 2, 1, 1, 3))
}) |
dlply <- function(.data, .variables, .fun = NULL, ..., .progress = "none",
.inform = FALSE, .drop = TRUE, .parallel = FALSE,
.paropts = NULL) {
.variables <- as.quoted(.variables)
pieces <- splitter_d(.data, .variables, drop = .drop)
llply(.data = pieces, .fun = .fun, ...,
.progress = .progress, .inform = .inform,
.parallel = .parallel, .paropts = .paropts)
} |
context("BAUs")
test_that("real_line_BAUs",{
library(sp)
data <- data.frame(x = seq(0,10,by=0.01), y = 0, z= runif(1001),std=0.5)
coordinates(data) <- ~x+y
Grid1D_df <- auto_BAUs(manifold = real_line(),
cellsize = 1,
data=data)
expect_is(Grid1D_df,"SpatialPixelsDataFrame")
expect_equal(names(Grid1D_df),c("x","y"))
expect_equal(mean(diff(Grid1D_df$x)),1)
f <- z ~ 1
binned_data1 <- map_data_to_BAUs(data,Grid1D_df,average_in_BAU = TRUE)
binned_data2 <- map_data_to_BAUs(data,Grid1D_df,average_in_BAU = FALSE)
expect_is(binned_data1,"SpatialPointsDataFrame")
expect_is(binned_data2,"SpatialPointsDataFrame")
expect_true(nrow(binned_data1) <= nrow(Grid1D_df))
C1 <- BuildC(binned_data1,Grid1D_df)
C2 <- BuildC(binned_data2,Grid1D_df)
expect_is(C1,"list")
expect_equal(names(C1),c("i_idx","j_idx", "x_idx"))
expect_equal(length(C1$i_idx),nrow(binned_data1))
expect_equal(length(C1$j_idx),nrow(binned_data1))
})
test_that("plane_BAUs",{
library(sp)
set.seed(1)
data <- data.frame(x = rnorm(5),y=rnorm(5),z = rnorm(5),std=1)
coordinates(data) <- ~x+y
if(require("INLA") & require("rgdal")) {
Grid2D <- auto_BAUs(manifold = plane(),
type="grid",
cellsize = 0.5,
data=data,
nonconvex_hull = TRUE)
expect_is(Grid2D,"SpatialPixelsDataFrame")
expect_equal(names(Grid2D),c("x","y"))
}
Grid2D <- auto_BAUs(manifold = plane(),
type="grid",
cellsize = 0.5,
data=data,
nonconvex_hull = FALSE)
expect_is(Grid2D,"SpatialPixelsDataFrame")
expect_equal(names(Grid2D),c("x","y"))
f <- z ~ 1
binned_data <- map_data_to_BAUs(data,Grid2D)
expect_is(binned_data,"SpatialPointsDataFrame")
expect_true(nrow(binned_data) <= nrow(Grid2D))
C <- BuildC(binned_data,Grid2D)
expect_is(C,"list")
expect_equal(names(C),c("i_idx","j_idx", "x_idx"))
expect_equal(length(C$i_idx),nrow(binned_data))
expect_equal(length(C$j_idx),nrow(binned_data))
Grid2D_limited <- auto_BAUs(manifold = plane(),
type="grid",
cellsize = 0.5,
data=data,
nonconvex_hull = FALSE,
xlims=c(-2,2),
ylims=c(-2,2))
expect_is(Grid2D_limited,"SpatialPixelsDataFrame")
expect_equal(names(Grid2D_limited),c("x","y"))
expect_equal(min(Grid2D_limited@data[,1]),-2)
expect_equal(max(Grid2D_limited@data[,1]),2)
expect_equal(min(Grid2D_limited@data[,2]),-2)
expect_equal(max(Grid2D_limited@data[,2]),2)
})
test_that("sphere_BAUs",{
isea3h_1 <- auto_BAUs(manifold=sphere(),
type="hex",
isea3h_res=1,
data=NULL)
expect_is(isea3h_1,"SpatialPolygonsDataFrame")
expect_equal(nrow(isea3h_1@data),39)
expect_equal(names(isea3h_1@data),c("id","lon","lat"))
expect_true(grepl("+proj=longlat",proj4string(isea3h_1)))
sphere_grid <- auto_BAUs(manifold=sphere(),
type="grid",
data=NULL,
cellsize=c(20,10))
expect_is(sphere_grid,"SpatialPolygonsDataFrame")
expect_equal(nrow(sphere_grid@data),324)
expect_equal(names(sphere_grid@data),c("lon","lat"))
expect_true(grepl("+proj=longlat",proj4string(sphere_grid)))
sphere_grid_limited <- auto_BAUs(manifold=sphere(),
type="grid",
data=NULL,
cellsize=c(20,10),
xlims=c(-100,120),
ylims=c(-80,70))
expect_is(sphere_grid_limited,"SpatialPolygonsDataFrame")
expect_equal(nrow(sphere_grid_limited@data),165)
expect_equal(names(sphere_grid_limited@data),c("lon","lat"))
expect_true(grepl("+proj=longlat",proj4string(sphere_grid_limited)))
expect_equal(min(sphere_grid_limited@data[,1]),-90)
expect_equal(max(sphere_grid_limited@data[,1]),110)
expect_equal(min(sphere_grid_limited@data[,2]),-75)
expect_equal(max(sphere_grid_limited@data[,2]),65)
})
test_that("SpaceTime_BAUs",{
library(sp)
library(spacetime)
sim_process <- expand.grid(x = seq(0.005,0.995,by=0.1),
y = seq(0.005,0.995,by=0.1),
t = seq(1,5,by = 1),
std = 0.5)
sim_process$z <- 1
time1 <- as.POSIXct("2015-09-01",tz="") + 3600*24*(sim_process$t-1)
space1 <- sim_process[,c("x","y")]
coordinates(space1) <- ~x+y
STobj1 <- STIDF(space1,time1,data=sim_process)
time_grid <- auto_BAUs(real_line(),
cellsize = 1,
d = as.Date(time(STobj1)),
tunit="days")
expect_is(time_grid,"POSIXct")
if(require("INLA") & require("rgdal")) {
space_time_grid <- auto_BAUs(STplane(),
type="hex",
cellsize = c(0.1,0.1,1),
data = STobj1,
tunit="days",
convex= -0.2,
nonconvex_hull = TRUE)
expect_is(space_time_grid,"STFDF")
expect_is(time(space_time_grid),"POSIXct")
}
space_time_grid <- auto_BAUs(STplane(),
type="hex",
cellsize = c(0.1,0.1,1),
data = STobj1,
tunit="days",
convex= -0.2,
nonconvex_hull = FALSE)
expect_is(space_time_grid,"STFDF")
expect_is(time(space_time_grid),"POSIXct")
STobj2 <- space_time_grid[1:5,1:3]
STobj2$z <- 1
f <- z ~ 1
binned_data1 <- FRK:::map_data_to_BAUs(STobj1,
space_time_grid,
average_in_BAU = TRUE)
binned_data2 <- FRK:::map_data_to_BAUs(STobj1,
space_time_grid,
average_in_BAU = FALSE)
expect_true(ncol(binned_data2) >= ncol(binned_data1))
expect_is(binned_data1,"STIDF")
expect_is(binned_data2,"STIDF")
C1 <- BuildC(binned_data1,space_time_grid)
C2 <- BuildC(binned_data2,space_time_grid)
expect_is(C1,"list")
expect_is(C2,"list")
expect_equal(names(C1),c("i_idx","j_idx", "x_idx"))
expect_equal(names(C2),c("i_idx","j_idx", "x_idx"))
expect_equal(length(C1$i_idx),as.numeric(nrow(binned_data1)))
expect_equal(length(C1$j_idx),as.numeric(nrow(binned_data1)))
STobj3 <- STIDF(space1,time1 + 4000,data=sim_process)
STobj3$z <- 1
f <- z ~ 1
binned_data3 <- FRK:::map_data_to_BAUs(STobj3,
space_time_grid,
average_in_BAU = TRUE)
binned_data4 <- FRK:::map_data_to_BAUs(STobj3,
space_time_grid,
average_in_BAU = FALSE)
expect_true(ncol(binned_data4) >= ncol(binned_data3))
expect_is(binned_data3,"STIDF")
expect_is(binned_data4,"STIDF")
space_time_grid2 <- auto_BAUs(STplane(),
type="hex",
cellsize = c(0.1,0.1,1),
data = STobj3,
tunit="days",
convex= -0.2,
nonconvex_hull = FALSE)
expect_equal(attr(space_time_grid@time,"tzone"),attr(STobj1@time,"tzone"))
})
test_that("Point from BAUs works",{
library(sp)
dat <- data.frame(x = rnorm(100),
y = rnorm(100))
coordinates(dat) <- ~x+y
BAUs <- BAUs_from_points(dat)
expect_is(BAUs,"SpatialPolygonsDataFrame")
expect_equal(length(BAUs),100)
dat$z <- rnorm(100)
BAUs <- BAUs_from_points(dat)
expect_is(BAUs,"SpatialPolygonsDataFrame")
expect_equal(length(BAUs),100)
}) |
options(prompt = "R> ", continue = "+", width = 70, useFancyQuotes = FALSE)
library("DClusterm")
data("NY8")
NY8$Observed <- round(NY8$Cases)
NY8$Expected <- NY8$POP8 * sum(NY8$Observed) / sum(NY8$POP8)
NY8$SMR <- NY8$Observed / NY8$Expected
NY8$x <- coordinates(NY8)[, 1]
NY8$y <- coordinates(NY8)[, 2]
library("RColorBrewer")
p1 <- spplot(NY8, "SMR", cuts = 8, col.regions = brewer.pal(9, "Oranges"),
main = "Standardized mortality ratio",
sp.layout = list(list("sp.points", TCE, col = "red")))
p2 <- spplot(NY8, "PCTOWNHOME", cuts = 8, col.regions = brewer.pal(9, "Blues"),
main = "PCTOWNHOME")
p3 <- spplot(NY8, "PCTAGE65P", cuts = 8, col.regions = brewer.pal(9, "Greens"),
main = "PCTAGE65P")
p4 <- spplot(NY8, "PEXPOSURE", cuts = 8, col.regions = brewer.pal(9, "Reds"),
main = "PEXPOSURE")
print(p1, position = c(0, 0.5, 0.5, 1), more = TRUE)
print(p2, position = c(0.5, 0.5, 1, 1), more = TRUE)
print(p3, position = c(0, 0, 0.5, 0.5), more = TRUE)
print(p4, position = c(0.5, 0, 1, 0.5))
ny.m0 <- glm(Observed ~ offset(log(Expected)) + 1, family = "poisson",
data = NY8)
options(mc.cores = 2)
idxcl <- c(120, 12, 89, 139, 146)
ny.cl0 <- DetectClustersModel(NY8,
thegrid = as.data.frame(NY8)[idxcl, c("x", "y")],
fractpop = 0.15, alpha = 0.05, radius = Inf, step = NULL,
typeCluster = "S", R = NULL, model0 = ny.m0,
ClusterSizeContribution = "POP8")
ny.cl0
NY8$CLUSTER0 <- get.allknclusters(NY8, ny.cl0)
ny.m1 <- glm(Observed ~ offset(log(Expected)) + PCTOWNHOME + PCTAGE65P +
PEXPOSURE, family = "poisson", data = NY8)
summary(ny.m1)
ny.cl1 <- DetectClustersModel(NY8,
thegrid = as.data.frame(NY8)[idxcl, c("x", "y")], fractpop = 0.15,
alpha = 0.05, typeCluster = "S", R = NULL, model0 = ny.m1,
ClusterSizeContribution = "POP8")
ny.cl1
NY8$CLUSTER1 <- get.allknclusters(NY8, ny.cl1)
library("gridExtra")
library("latticeExtra")
ny.map0 <- spplot(NY8, c("CLUSTER0"), col.regions = c("white", "gray"),
col = "
layer(lpoints(ny.cl0$x, ny.cl0$y, pch = 19))
ny.map1 <- spplot(NY8, c("CLUSTER1"), col.regions = c("white", "gray"),
col = "
layer(lpoints(ny.cl1$x, ny.cl1$y, pch = 19))
syracuse <- which(NY8$AREANAME == "Syracuse city")
ny.map0.s <- spplot(NY8[syracuse, ], c("CLUSTER0"), col.regions = c("white", "gray"),
col = "
layer(lpoints(ny.cl0$x, ny.cl0$y, pch = 19))
ny.map1.s <- spplot(NY8[syracuse, ], c("CLUSTER1"), col.regions = c("white", "gray"),
col = "
layer(lpoints(ny.cl1$x, ny.cl1$y, pch = 19))
grid.arrange(ny.map0, ny.map1, ny.map0.s, ny.map1.s, ncol = 2)
slimknclusters(NY8, ny.cl1, 3)
DeanB(ny.m0)
DeanB2(ny.m0)
DeanB(ny.m1)
DeanB2(ny.m1)
library("lme4")
ny.mm0 <- glmer(Observed ~ offset(log(Expected)) + (1 | AREANAME),
data = as(NY8, "data.frame"), family = "poisson")
ny.clmm0 <- DetectClustersModel(NY8,
thegrid = as.data.frame(NY8)[idxcl, c("x", "y")], fractpop = 0.15,
alpha = 0.05, typeCluster = "S", R = NULL, model0 = ny.mm0,
ClusterSizeContribution = "POP8")
ny.clmm0
ny.mm1 <- glmer(Observed ~ offset(log(Expected)) + PCTOWNHOME +
PCTAGE65P + PEXPOSURE + (1 | AREANAME),
data = as(NY8, "data.frame"), family = "poisson")
ny.clmm1 <- DetectClustersModel(NY8,
thegrid = as.data.frame(NY8)[idxcl, c("x", "y")], fractpop = 0.15,
alpha = 0.05, typeCluster = "S", R = NULL, model0 = ny.mm1,
ClusterSizeContribution = "POP8")
ny.clmm1
NY8$CLUSTERMM0 <- get.allknclusters(NY8, ny.clmm0)
NY8$CLUSTERMM1 <- get.allknclusters(NY8, ny.clmm1)
ny.mapmm0 <- spplot(NY8, c("CLUSTERMM0"), col.regions = c("white", "gray"),
col = "
layer(lpoints(ny.clmm0$x, ny.clmm0$y, pch = 19))
ny.mapmm1 <- spplot(NY8, c("CLUSTERMM1"), col.regions = c("white", "gray"),
col = "
layer(lpoints(ny.clmm1$x, ny.clmm1$y, pch = 19))
ny.mapmm0.s <- spplot(NY8[syracuse, ], c("CLUSTERMM0"), col.regions = c("white", "gray"),
col = "
layer(lpoints(ny.clmm0$x, ny.clmm0$y, pch = 19))
ny.mapmm1.s <- spplot(NY8[syracuse, ], c("CLUSTERMM1"), col.regions = c("white", "gray"),
col = "
layer(lpoints(ny.clmm1$x, ny.clmm1$y, pch = 19))
grid.arrange(ny.mapmm0, ny.mapmm1, ny.mapmm0.s, ny.mapmm1.s, ncol = 2)
library("DClusterm")
data("Navarre")
print(spplot(brainnav, "SMR", cuts = 8,
col.regions = brewer.pal(9, "Oranges")))
nav.m0 <- glm(OBSERVED ~ offset(log(EXPECTED)) + 1, family = "poisson",
data = brainnav)
nav.m0q <- glm(OBSERVED ~ offset(log(EXPECTED)) + 1, data = brainnav,
family = "quasipoisson")
library("pscl")
nav.m0zip <- zeroinfl(OBSERVED ~ offset(log(EXPECTED)) + 1 | 1,
data = brainnav, dist = "poisson", x = TRUE)
summary(nav.m0zip)
nav.cl0 <- DetectClustersModel(brainnav, coordinates(brainnav),
fractpop = 0.25, alpha = 0.05, typeCluster = "S", R = NULL,
model0 = nav.m0zip, ClusterSizeContribution = "EXPECTED")
nav.cl0
nav.clusters <- get.knclusters(brainnav, nav.cl0)
brainnav$CLUSTER <- ""
brainnav$CLUSTER [ nav.clusters[[1]] ] <- "CLUSTER"
brainnav$CLUSTER <- as.factor(brainnav$CLUSTER)
print(spplot(brainnav, "CLUSTER", col = "
col.regions = c("white", "grey")) )
data("brainNM")
print(stplot(brainst[, , "SMR"], cuts = 8,
col.regions = brewer.pal(9, "Oranges")))
nm.m0 <- glm(Observed ~ offset(log(Expected)) + 1, family = "poisson",
data = brainst)
summary(nm.m0)
NM.coords <- coordinates(brainst@sp)
nm.cl0 <- DetectClustersModel(brainst, NM.coords,
minDateUser = "1985-01-01", maxDateUser = "1989-01-01",
fractpop = 0.15, alpha = 0.05, typeCluster = "ST", R = NULL,
model0 = nm.m0, ClusterSizeContribution = "Expected")
nm.cl0.s <- slimknclusters(brainst, nm.cl0)
nm.cl0.s
dst <- spDistsN1(pts = NM.coords, pt = losalamos, longlat = TRUE)
nyears <- length(unique(brainst$Year))
brainst$IDLANL <- rep(1 / dst, nyears)
nm.m1 <- glm(Observed ~ offset(log(Expected)) + IDLANL,
family = "poisson", data = brainst)
summary(nm.m1)
nm.cl1 <- DetectClustersModel(brainst, NM.coords, fractpop = 0.15,
alpha = 0.05, minDateUser = "1985-01-01", maxDateUser = "1989-01-01",
typeCluster = "ST", R = NULL, model0 = nm.m1,
ClusterSizeContribution = "Expected")
nm.cl1.s <- slimknclusters(brainst, nm.cl1)
nm.cl1.s
stcl <- get.stclusters(brainst, nm.cl0.s)
brainst$CLUSTER <- ""
brainst$CLUSTER[ stcl[[1]] ] <- "CLUSTER"
print(stplot(brainst[, , "CLUSTER"], at = c(0, 0.5, 1.5), col = "
col.regions = c("white", "gray"))) |
datelife_search <- function(input = c("Rhea americana", "Pterocnemia pennata", "Struthio camelus"),
use_tnrs = FALSE,
get_spp_from_taxon = FALSE,
partial = TRUE,
cache = "opentree_chronograms",
summary_format = "phylo_all",
na_rm = FALSE,
summary_print = c("citations", "taxa"),
taxon_summary = c("none", "summary", "matrix"),
criterion = "taxa") {
message("... Running a DateLife search.")
datelife_query <- input
if (suppressMessages(!is_datelife_query(input))) {
datelife_query <- make_datelife_query(
input = input,
use_tnrs = use_tnrs,
get_spp_from_taxon = get_spp_from_taxon
)
}
datelife_result.here <- get_datelife_result_datelifequery(
datelife_query = datelife_query,
partial = partial,
cache = cache)
res <- summarize_datelife_result(
datelife_result = datelife_result.here,
datelife_query = datelife_query,
summary_format = summary_format,
na_rm = na_rm,
summary_print = summary_print,
taxon_summary = taxon_summary,
criterion = criterion
)
attr(res, "datelife_result") <- datelife_result.here
message("DateLife search done!")
return(res)
}
is_datelife_result_empty <- function(datelife_result,
use_tnrs = FALSE) {
if (length(datelife_result) < 1) {
warning("'datelife_result' object is empty.", call. = FALSE)
message("'input' taxon names were not found in the local chronogram database.")
if (!use_tnrs) {
message("setting 'use_tnrs = TRUE' might change this, but it is time consuming.")
}
return(TRUE)
}
return(FALSE)
}
"threebirds_dr" |
dunnett.test <-
function (Z = Z, select = rep(1, length(Z)))
{
if(sum(is.na(Z))>0){stop("No missing values allowed in Z")}
treats <- length(Z)
hyp.comb <- list(NULL)
nhyp.comb <- vector(length = treats)
for (i in 1:treats) {
comb.dat <- combn(1:treats, i)
hyp.comb[[i]] <- comb.dat
nhyp.comb[i] <- ncol(hyp.comb[[i]])
rownames(hyp.comb[[i]]) <- 1:i
hypcol <- NULL
for (j in 1:nhyp.comb[i]) {
ihypcol <- paste("H", paste(hyp.comb[[i]][, j], collapse = ""),
sep = "")
hypcol <- append(hypcol, ihypcol)
}
colnames(hyp.comb[[i]]) <- hypcol
}
pdunnett.test <- list(NULL)
zscores <- list(NULL)
int_dunnett <- function(x, z, k) {
((pnorm(sqrt(2) * z + x))^k) * dnorm(x)
}
for (i in 1:treats) {
ptest <- NULL
if (select[i] == 0) {
Z[i] <- -Inf
}
for (j in 1:nhyp.comb[i]) {
kselect <- sum(select[c(hyp.comb[[i]][, j])])
Zmax <- max(Z[c(hyp.comb[[i]][, j])])
if (kselect == 0) {
dunnet_integral <- 0
F_Zmax <- 1
}
else {
dunnett_integral <- integrate(int_dunnett, -Inf,
Inf, z = Zmax, k = kselect)
F_Zmax <- 1 - dunnett_integral$value
}
ptest <- append(ptest, F_Zmax)
}
pdunnett.test[[i]] <- matrix(ptest, nrow = 1, ncol = length(ptest))
colnames(pdunnett.test[[i]]) <- colnames(hyp.comb[[i]])
rownames(pdunnett.test[[i]]) <- 1
zscores[[i]] <- qnorm(1 - pdunnett.test[[i]])
}
list(pvalues = pdunnett.test, zscores = zscores, hyp.comb = hyp.comb)
} |
hclustdd <-
function(xf, group.name="group",
distance = c("l1", "l2", "chisqsym", "hellinger", "jeffreys", "jensen", "lp"),
sub.title="", filename=NULL, method.hclust = "complete"
)
{
if (! (is.folder(xf) | is.data.frame(xf) | all(sapply(xf,is.array))) ) {
stop("hclustdd applies to a data frame, an object of class 'folder' or a list of arrays or tables.")
}
if (is.folder(xf)) {
x <- as.data.frame(xf, group.name = group.name)
colnames(x)[ncol(x)] <- "group"
group <- as.factor(x$group)
nb.groups <- length(levels(group))
groups.name <- levels(group)
vars.name <- colnames(x)[1:(ncol(x)-1)]
levels.name <- list()
for(j in vars.name) {levels.name = c(levels.name, list(levels(x[,j])))}
if (any(is.na(x)))
stop("There are NAs in the folder")
tab <- lapply(xf, table)
} else if (is.data.frame(xf)) {
if (!group.name %in% names(xf))
stop(paste0("xf has no column named '", group.name, "'."))
group <- as.factor(xf[, group.name])
groups.name <- levels(group)
x <- xf[which(colnames(xf) != group.name)]
vars.name <- colnames(x)
tab <- by(x, group, table)
names(tab) <- groups.name
} else {
nomdim <- lapply(xf, dimnames)
identdim <- sapply(nomdim, function(x) identical(x, nomdim[[1]]))
if (!all(identdim))
stop("If xf is a list of arrays, all its components must have the same dimensions and dimension names.")
tab <- xf
is.negative <- sapply(xf, function(x) any(x < 0))
if (any(is.negative)) {
stop("All elements of xf must be arrays with non negative elements.")
}
nb.groups <- length(tab)
groups.name <- names(tab)
vars.name <- names(dimnames(tab[[1]]))
levels.name = dimnames(tab[[1]])
}
nb.vars = length(vars.name)
dims <- dim(tab[[1]])
freq <- lapply(tab, function(x){x/sum(x)})
distance <- match.arg(distance)
if (distance == "l1") {
distance <- "lp"
p <- 1
distance.printing <- "l1"
}
if (distance == "l2") {
distance <- "lp"
p <- 2
distance.printing <- "l2"
}
if (distance == "lp") {
if (missing(p))
p <- 1
distance.printing <- paste("lp with p =", p)
}
switch(distance,
"lp" = {
matdist <- matddlppar(freq, p = p)
},
"hellinger" = {
matdist <- matddhellingerpar(freq)
},
"chisqsym" = {
matdist <- matddchisqsympar(freq)
},
"jeffreys" = {
matdist <- matddjeffreyspar(freq)
},
"jensen" = {
matdist <- matddjensenpar(freq)
}
)
if( all(is.finite(matdist)) ) {
xclust <- hclust(matdist, method = method.hclust, members = NULL)
results <- list(distances = matdist, clust = xclust)
class(results) <- "hclustdd"
return(results)
} else {
warning("Some distances between groups are infinite. The choice of distance is not pertinent")
results <- list(distances = matdist, clust = NULL)
class(results) <- "hclustdd"
return(results)
}
} |
NULL
col_is_integer <- function(x,
columns,
actions = NULL,
step_id = NULL,
label = NULL,
brief = NULL,
active = TRUE) {
preconditions <- NULL
values <- NULL
columns <- rlang::enquo(columns)
columns_expr <-
rlang::as_label(rlang::quo(!!enquo(columns))) %>%
gsub("^\"|\"$", "", .)
columns <- resolve_columns(x = x, var_expr = columns, preconditions = NULL)
if (is_a_table_object(x)) {
secret_agent <-
create_agent(x, label = "::QUIET::") %>%
col_is_integer(
columns = columns,
label = label,
brief = brief,
actions = prime_actions(actions),
active = active
) %>%
interrogate()
return(x)
}
agent <- x
if (is.null(brief)) {
brief <-
generate_autobriefs(
agent, columns, preconditions, values, "col_is_integer"
)
}
step_id <- normalize_step_id(step_id, columns, agent)
i_o <- get_next_validation_set_row(agent)
check_step_id_duplicates(step_id, agent)
for (i in seq(columns)) {
agent <-
create_validation_step(
agent = agent,
assertion_type = "col_is_integer",
i_o = i_o,
columns_expr = columns_expr,
column = columns[i],
preconditions = NULL,
actions = covert_actions(actions, agent),
step_id = step_id[i],
label = label,
brief = brief[i],
active = active
)
}
agent
}
expect_col_is_integer <- function(object,
columns,
threshold = 1) {
fn_name <- "expect_col_is_integer"
vs <-
create_agent(tbl = object, label = "::QUIET::") %>%
col_is_integer(
columns = {{ columns }},
actions = action_levels(notify_at = threshold)
) %>%
interrogate() %>%
.$validation_set
x <- vs$notify
threshold_type <- get_threshold_type(threshold = threshold)
if (threshold_type == "proportional") {
failed_amount <- vs$f_failed
} else {
failed_amount <- vs$n_failed
}
if (length(x) > 1 && any(x)) {
fail_idx <- which(x)[1]
failed_amount <- failed_amount[fail_idx]
x <- TRUE
} else {
x <- any(x)
fail_idx <- 1
}
if (inherits(vs$capture_stack[[1]]$warning, "simpleWarning")) {
warning(conditionMessage(vs$capture_stack[[1]]$warning))
}
if (inherits(vs$capture_stack[[1]]$error, "simpleError")) {
stop(conditionMessage(vs$capture_stack[[1]]$error))
}
act <- testthat::quasi_label(enquo(x), arg = "object")
column_text <- prep_column_text(vs$column[[fail_idx]])
col_type <- "integer"
testthat::expect(
ok = identical(!as.vector(act$val), TRUE),
failure_message = glue::glue(
failure_message_gluestring(
fn_name = fn_name, lang = "en"
)
)
)
act$val <- object
invisible(act$val)
}
test_col_is_integer <- function(object,
columns,
threshold = 1) {
vs <-
create_agent(tbl = object, label = "::QUIET::") %>%
col_is_integer(
columns = {{ columns }},
actions = action_levels(notify_at = threshold)
) %>%
interrogate() %>%
.$validation_set
if (inherits(vs$capture_stack[[1]]$warning, "simpleWarning")) {
warning(conditionMessage(vs$capture_stack[[1]]$warning))
}
if (inherits(vs$capture_stack[[1]]$error, "simpleError")) {
stop(conditionMessage(vs$capture_stack[[1]]$error))
}
all(!vs$notify)
} |
apiTypesInfo <- list()
plumberToApiTypeMap <- list()
defaultApiType <- structure("string", default = TRUE)
defaultIsArray <- structure(FALSE, default = TRUE)
add_api_info_onLoad <- function() {
addApiInfo <- function(apiType, plumberTypes,
regex = NULL, converter = NULL,
format = NULL,
location = NULL,
realType = NULL) {
apiTypesInfo[[apiType]] <<-
list(
regex = regex,
converter = converter,
format = format,
location = location,
realType = realType,
regexArray = paste0("(?:(?:", regex, "),?)+"),
converterArray = function(x) {converter(stri_split_fixed(x, ",")[[1]])}
)
for (plumberType in plumberTypes) {
plumberToApiTypeMap[[plumberType]] <<- apiType
}
plumberToApiTypeMap[[apiType]] <<- apiType
invisible(TRUE)
}
addApiInfo(
"boolean",
c("bool", "boolean", "logical"),
"[01tfTF]|true|false|TRUE|FALSE",
as.logical,
location = c("query", "path")
)
addApiInfo(
"number",
c("dbl", "double", "float", "number", "numeric"),
"-?\\\\d*\\\\.?\\\\d+",
as.numeric,
format = "double",
location = c("query", "path")
)
addApiInfo(
"integer",
c("int", "integer"),
"-?\\\\d+",
as.integer,
format = "int64",
location = c("query", "path")
)
addApiInfo(
"string",
c("chr", "str", "character", "string"),
"[^/]+",
as.character,
location = c("query", "path")
)
addApiInfo(
"object",
c("list", "data.frame", "df"),
location = "requestBody"
)
addApiInfo(
"file",
c("file", "binary"),
location = "requestBody",
format = "binary",
realType = "string"
)
}
plumberToApiType <- function(type, inPath = FALSE) {
if (length(type) > 1) {
return(vapply(type, plumberToApiType, character(1), inPath, USE.NAMES = FALSE))
}
if (is.na(type)) {
return(defaultApiType)
}
apiType <- plumberToApiTypeMap[[as.character(type)]]
if (is.null(apiType)) {
warning(
"Unrecognized type: ", type, ". Using type: ", defaultApiType,
call. = FALSE
)
apiType <- defaultApiType
}
if (inPath && !"path" %in% apiTypesInfo[[apiType]]$location) {
warning(
"Unsupported path parameter type: ", type, ". Using type: ", defaultApiType,
call. = FALSE
)
apiType <- defaultApiType
}
return(apiType)
}
filterApiTypes <- function(matches, property) {
names(Filter(function(x) {any(matches %in% x[[property]])}, apiTypesInfo))
} |
tidy.Arima <- function(x, conf.int = FALSE, conf.level = 0.95, ...) {
coefs <- stats::coef(x)
ses <- rep.int(0, length(coefs))
ses[x$mask] <- sqrt(diag(x$var.coef))
ret <- unrowname(data.frame(
term = names(coefs),
estimate = coefs,
std.error = ses
))
if (conf.int) {
ci <- broom_confint_terms(x, level = conf.level)
ret <- dplyr::left_join(ret, ci, by = "term")
}
as_tibble(ret)
}
glance.Arima <- function(x, ...) {
ret <- tibble(sigma = sqrt(x$sigma2))
ret$logLik <- tryCatch(as.numeric(stats::logLik(x)), error = function(e) NULL)
if (!is.na(ret$logLik)) {
ret$AIC <- tryCatch(stats::AIC(x), error = function(e) NULL)
ret$BIC <- tryCatch(stats::BIC(x), error = function(e) NULL)
}
ret$nobs <- stats::nobs(x)
as_tibble(ret)
} |
`gen.Data.glmFormula` <-
function(fmla, pars, var.Frame, data.Sigma=1, data.Size, train.Frame, test.Size, ...){
if(dim(train.Frame)[1] > dim(var.Frame)[1]) stop ("Screwed up training frame / var.Frame")
Terms <- delete.response(terms(fmla))
m <- model.frame(Terms, var.Frame)
X <- model.matrix(Terms, m)
temp <- X %*% pars
prob.Vector <- exp(temp)/(1+exp(temp))
temp <- rbinom(n = length(prob.Vector), size = 1, prob = prob.Vector)
train.Size <- dim(train.Frame)[1]
train.Inds = 1:train.Size
test.Inds = (train.Size + 1):dim(var.Frame)[1]
if(dim(train.Frame)[1] == dim(var.Frame)[1]) test.Inds = NULL
list(data.Vector = temp[train.Inds], test.Vector = temp[test.Inds])
} |
suppressPackageStartupMessages({
require(data.table)
require(jsonlite)
require(ggplot2)
require(cowplot)
})
.args <- commandArgs(trailingOnly = T)
load(.args[1])
refpars <- readRDS(.args[3])[, seropos := 1 - seroneg9 ]
reducedrois <- readRDS(.args[2])[mechanism == "binary"][
refpars, on = .(foi, disparity)
][, roi,
by = .(foi, disparity, seropos, p_H, log10OR, nu, tau, A, L)
]
rename <- function(res, ref) { names(res) <- ref; return(res) }
foiref <- refpars[, seropos[1], by = .(ref = foi)][, rename(V1, ref)]
pHref <- refpars[, p_H[1], by = .(ref = disparity)][, rename(V1, ref)]
ORref <- refpars[, log10OR[1], by = .(ref = disparity)][, rename(V1, ref)]
disref <- list(
md = quote(Disparity ~ (p[H] * ", " * log[10] * OR)),
ll = quote(phantom("Disparity" ~ (p[H] * ", " * log[10] * OR))),
ul = quote(phantom("Disparity" ~ (p[H] * ", " * log[10] * OR)))
)
plot.dt <- reducedrois[
disparity == "ll" & foi == "ul" &
(nu - 0.5) ^ 2 < 0.0001 &
log10(tau) %in% seq(-2, -1, by = .5)
]
scale_start_age <- scale_x_continuous(
"Initial Age for Routine Testing",
breaks = 5:10,
expand = expand_scale(add = 0.5)
)
scale_num_tests <- scale_y_continuous(
"Maximum
breaks = function(lims) seq(round(lims[1]), round(lims[2]), by = 1),
expand = expand_scale(add = 0.5)
)
p <- ggplot(plot.dt) + aes(
A, L,
fill = roi, z = roi, color = c("neg", "pos")[(roi > 0) + 1]
) + facet_grid(
disparity + nu + foi ~ tau,
labeller = label_bquote(
rows = atop(
nu * " = " * .(sprintf("%0.1f", nu)) * ", " * .(
c(ll = "Low", md = "Mid", ul = "High")[disparity]
) * " Disparity",
.(
c(ll = 50, md = 70, ul = 90)[foi]
) * "% " * S ^ "+" * " in 9-year-olds"
),
cols = tau * " = " * .(sprintf("%0.2f", tau))
)
) +
geom_heat +
coord_cartesian(xlim = c(5, 10), ylim = c(1, 10)) +
scale_num_tests + scale_start_age + scale_roi +
scale_contour + thm + theme(
panel.spacing.x = unit(12, "pt")
)
save_plot(
tail(.args, 1), p,
ncol = plot.dt[, length(unique(tau))], nrow = 1,
base_height = 3.5, base_width = 4
) |
points2 <- function(x,y,img,...) {
plot.xs <- y
plot.ys <- (x - nrow(img))*-1
points(plot.xs,plot.ys,...)
}
|
options(Encoding="UTF-8")
knitr::opts_chunk$set(
fig.width = 8,
fig.height = 5,
collapse = TRUE,
comment = "
)
library(segclust2d)
data(simulshift)
data(simulmode)
simulmode$abs_spatial_angle <- abs(simulmode$spatial_angle)
simulmode <- simulmode[!is.na(simulmode$abs_spatial_angle), ]
lmin <- 240
subsample_by <- 60
cli::cli_alert_success("Using {cli::col_green('lmin = ', lmin )}")
lmin <- max(lmin/subsample_by,5)
cli::cli_alert_success(
"Adjusting lmin to subsampling.
{cli::col_grey('Dividing lmin by ',subsample_by,', with a minimum of 5')}")
cli::cli_alert("After subsampling, {cli::col_green('lmin = ', lmin)}.
{cli::col_grey('Corresponding to lmin = ',lmin*subsample_by,
' on the original time scale')}")
seg.var <- c("x","y")
cli::cli_alert_danger(
"Data have repetition of nearly-identical \\
values longer than lmin.
{cli::col_grey('The algorithm cannot estimate variance \\
for segment with repeated values. \\
This is potentially caused by interpolation \\
of missing values or rounding of values.')}
{cli::symbol$arrow_right} Please check for repeated \\
or very similar values of {seg.var}") |
var_1 <- labelled::labelled_spss(
x = c(1,0,1,1,0,8,9),
labels = c("TRUST" = 1,
"NOT TRUST" = 0,
"DON'T KNOW" = 8,
"INAP. HERE" = 9),
na_values = c(8,9))
str(var_1)
h1 <- harmonize_values (
x = var_1,
harmonize_labels = list (
from = c("^tend\\sto|^trust", "^tend\\snot|not\\strust", "^dk|^don", "^inap"),
to = c("trust", "not_trust", "do_not_know", "inap"),
numeric_values = c(1,0,99997, 99999)),
na_values = c("do_not_know" = 99997,
"declined" = 99998,
"inap" = 99999),
id = "survey_id",
harmonize_label = "Do you trust the European Union?"
)
var_warn <- labelled::labelled_spss(
x = c(1,0,1,1,0,8,99999),
labels = c("TRUST" = 1,
"NOT TRUST" = 0,
"DON'T KNOW" = 8,
"INAP. HERE" = 99999),
na_values = c(8,9))
test_that("warning works", {
expect_warning(harmonize_values (
x = var_warn ,
harmonize_labels = list (
from = c("^tend\\sto|^trust", "^tend\\snot|not\\strust", "^dk|^don", "^inap"),
to = c("trust", "not_trust", "do_not_know", "inap"),
numeric_values = c(1,0,99997, 99999)),
na_values = c("do_not_know" = 99997,
"declined" = 99998,
"inap" = 99999),
id = "survey_id",
harmonize_label = "Do you trust the European Union?"
))
})
test_that("casting works", {
expect_equal(inherits(h1, "haven_labelled_spss"), TRUE)
expect_equal(is.numeric(h1), TRUE)
expect_equal(is.double(h1), TRUE)
})
test_that("attributes work", {
expect_equal(attr(h1, "label"), "Do you trust the European Union?")
expect_equal(attr(h1, "id"), "survey_id")
expect_equal(attr(h1, "survey_id_labels"),
c("TRUST" = 1,
"NOT TRUST" = 0,
"DON'T KNOW" = 8,
"INAP. HERE" = 9))
expect_equal(attr(h1, "survey_id_values"),
c("0" = 0,
"1" = 1,
"8" = 99997,
"9" = 99999))
})
attributes(h1)
test_that("recoding works", {
expect_equal(vctrs::vec_data(h1), c(1,0,1,1,0,99997,99999))
})
lvar2 <- labelled::labelled_spss(x = c(1,0,7,9),
labels = c("TRUST" = 1,
"NOT TRUST" = 0,
"DON'T KNOW" = 7,
"INAP. HERE" = 9),
na_values = c(8,9),
na_range = c(7,9))
test_that("recasting works", {
expect_equal(as_numeric(h1), c(1,0,1,1,0,NA,NA))
expect_equal(levels(as_factor(h1)),
c("not_trust", "trust", "do_not_know", "declined", "inap"))
expect_equal(as_character(h1), c("trust", "not_trust",
"trust", "trust", "not_trust",
"do_not_know", "inap"))
expect_equal(as_factor(h1),factor (
x = c("trust", "not_trust",
"trust", "trust", "not_trust",
"do_not_know", "inap"),
levels = c("not_trust","trust", "do_not_know", "declined", "inap")))
expect_equal(
as_numeric(
harmonize_values (
x = lvar2,
harmonize_labels = list (
from = c("^tend\\sto|^trust", "^tend\\snot|not\\strust", "^dk|^don", "^inap"),
to = c("trust", "not_trust", "do_not_know", "inap"),
numeric_values = c(1,0,99997, 99999)),
na_values = c("do_not_know" = 99997,
"inap" = 99999),
id = "survey_id"
)
), c(1,0,NA,NA)
)
})
test_that("exception handling works", {
expect_error(expect_warning ((harmonize_values (var_1,
harmonize_labels = list(
wrong_from = c("a", "b"),
wrong_to = c("ab", "bc"))
)))
)
expect_error (harmonize_values (var_1,
harmonize_labels = c("a", "b"))
)
expect_error (harmonize_values (var_1,
harmonize_labels = list (
from = c("^tend\\sto|^trust", "^tend\\snot|not\\strust", "^dk|^don", "^inap"),
to = c("trust", "not_trust", "do_not_know", "inap"),
numeric_values = c(1,0,3,99997, 99999)),
na_values = c("do_not_know" = 99997,
"declined" = 99998,
"inap" = 99999))
)
expect_error (harmonize_values (
x = lvar2,
harmonize_labels = list (
from = c("^tend\\sto|^trust", "^tend\\snot|not\\strust", "^dk|^don", "^inap", "missing"),
to = c("trust", "not_trust", "do_not_know", "inap", "inap"),
numeric_value = c(1,0,99997, 99999, 9999)),
na_values = c("do_not_know" = 99997,
"inap" = 99999),
id = "survey_id"
))
}) |
unite <- function(data, col, ..., sep = "_", remove = TRUE, na.rm = FALSE) {
col <- deparse_var(col)
cols_pos <- if (missing(...)) seq_along(data) else select_positions(data, ...)
to_unite <- data[, cols_pos, drop = FALSE]
data[[col]] <- if (isTRUE(na.rm)) {
apply(to_unite, 1L, function(x) paste(stats::na.omit(x), collapse = sep))
} else {
apply(to_unite, 1L, paste, collapse = sep)
}
if (isTRUE(remove)) {
to_rm <- setdiff(colnames(to_unite), col)
if (is.grouped_df(data) && length(to_rm) > 0L) {
rm_groups <- as_symbols(intersect(group_vars(data), to_rm))
data <- do.call(ungroup, squash(list(x = data, rm_groups)))
}
data[, to_rm] <- NULL
} else {
data <- eval(bquote(relocate(data, col, .before = .(cols_pos[1]))))
}
data
} |
riv_sdest <- function(Y, Xend, Xex, Zinst, intercept) {
if (is.null(Xex)) {
X <- Xend
Z <- cbind(Xend, Zinst, Y)
} else {
X <- cbind(Xend, Xex)
Z <- cbind(Xend, Zinst, Xex, Y)
}
res1 <- CovSde(Z, tune = 0.95, prob = 0.99)
L <- res1@center
V <- res1@cov
n <- length(Y)
p <- ncol(X)
k <- ncol(Zinst)
r <- k + p + 1
kend <- ncol(Xend)
Vm <- matrix(V[(kend + 1):(nrow(V) - 1), -((kend + 1):(kend + k))],
nrow = nrow(V) - kend - 1)
Swx <- Vm[, -ncol(Vm)]
Sxw <- t(Swx)
Sww <- matrix(V[(kend + 1):(nrow(V) - 1), (kend + 1):(nrow(V) - 1)],
nrow = nrow(V) - kend - 1)
Swy <- Vm[, ncol(Vm)]
Lm <- L[-((kend + 1):(kend + k))]
Mx <- Lm[1:(length(Lm) - 1)]
My <- Lm[length(Lm)]
part1 <- Sxw %*% solve(Sww) %*% Swx
b1 <- solve(part1) %*% Sxw %*% solve(Sww) %*% Swy
b0 <- My - sum(b1 * Mx)
if (intercept) {
beta.oiv <- matrix(rbind(b0, b1), ncol = 1, dimnames = NULL)
} else {
beta.oiv <- b1
}
tabRIV <- beta.oiv
colnames(tabRIV) <- 'Coef'
if (intercept)
rownames(tabRIV) <- c('Intercept', colnames(X))
else
rownames(tabRIV) <- colnames(X)
list(Summary.Table = tabRIV)
} |
context("strip_query")
test_that("strip_query strips limit and offset", {
expect_equal(strip_query("limit 1"), "")
expect_equal(strip_query("limit 1 "), " ")
expect_equal(strip_query("a limit 1"), "a ")
expect_equal(strip_query("offset 1 "), " ")
expect_equal(strip_query("a offset 1"), "a ")
expect_equal(strip_query("limit 1 offset 1"), " ")
expect_equal(strip_query("a limit 1 offset 1"), "a ")
expect_equal(strip_query("offset 1 limit 1"), " ")
expect_equal(strip_query("a offset 1 limit 1"), "a ")
expect_equal(strip_query("a offset 1 limit 1 order by b"), "a order by b")
}) |
read.echogram <-
function( hac, channel = NULL ) {
hacR <- readHAC::readHAC( hac )
tuple.types <- unique(hacR$type)
echosTupt <- c(100, 200, 210, 901)
channelTupt <- c(1000, 1001, 2000, 2001, 2002, 2100, 9001)
pingtupt <- c(10000, 10010, 10030, 10040, 10050)
ett <- echosTupt[which(echosTupt %in% tuple.types)]
ctt <- channelTupt[which(channelTupt %in% tuple.types)]
ptt <- pingtupt[which(pingtupt %in% tuple.types)]
if ( missing(channel) )
channel <- min(hacR$softwarechannel, na.rm=TRUE)
esTup <- hacR[hacR[["type"]] == ett]
chanTup <- hacR[hacR[["type"]] == ctt & hacR[["softwarechannel"]] == channel]
pngTup <- hacR[hacR[["type"]] %in% ptt & hacR[["softwarechannel"]] == channel]
pTl <- unique(pngTup$length)
nm <- length(pTl)
if ( nm < 3){
for ( i in 1:nm ) {
pTup <- subset(pngTup, length == pTl[i])
Sv <- readHAC::parseHAC(pTup)$"Sample value"
Sv[Sv > 0] <- NA
if ( unique(pTup$type) == 10030 )
Sv <- Sv * 10
if ( !inherits(Sv, "matrix") )
Sv <- matrix(Sv, ncol=1)
assign(paste("Sv", i, sep="."), Sv)
}
Sv <- get("Sv.1")
if ( nm > 1)
for ( m in 2:nm ){
Sv <- mergeSvmat(Sv, get(paste("Sv", m, sep=".")))
}
} else {
x <- split(pngTup, pngTup$pointer)
y <- lapply(x, readHAC::parseHAC)
z <- lapply(y, function(x) x$"Sample value")
zz <- lapply(z, function(x) matrix(x, ncol=1) )
n <- length(pngTup$type)
for ( k in 1:n ) {
if ( pngTup$type[k] == 10030 )
zz[[k]] <- zz[[k]] * 10
}
Sv <- zz[[1]]
for (g in 2:length(zz))
Sv <- mergeSvmat(Sv, zz[[g]])
Sv[Sv >= 0] <- NA
}
frq <- readHAC::parseHAC(chanTup)$"Acoustic frequency"/1000
attr(Sv, "frequency") <- paste(frq, "kHz")
tsi <- readHAC::parseHAC(chanTup)$"Time sample interval"
ss <- readHAC::parseHAC(esTup)$"Sound speed"
dim1 <- dim(Sv)[1]
if ( is.null(tsi) ) {
sLen <- readHAC::parseHAC(chanTup)$"Sampling interval"
} else sLen <- (ss * tsi)/2
vLen <- c(sLen/2, rep(sLen, dim1-1))
depth <- cumsum(vLen)
bot <- bottom.hac( hacR, channel )
pos <- position.hac( hacR )
pos <- navigation.hac(pos)
np <- nrow(bot)
dbot <- data.frame(bot, speed = NA, cumdist = NA)
if (nrow(pos) > 1){
for (k in 1:np){
p <- bot$pingTime[k]
tdif <- abs(difftime(pos$time.cpu, p, units="secs"))
idx <- which.min(tdif)
dbot[k, 'speed'] <- pos$navspeed[idx]
}
tdif <- c(0, difftime(dbot[2:np, 'pingTime'], dbot[1:(np-1), 'pingTime'], units = 'hours'))
dist <- dbot$speed * tdif
dbot$cumdist <- cumsum(dist)
}
ans <- list(depth = depth, Sv = Sv, pings = dbot)
class(ans) <- "echogram"
ans
} |
asym_m_ng <- function(y, data, FS, medstar = c(0.01,0.0001), numb = 100, burnin = 1, every = 1 ) {
g1 <- which( FS > 0.5 )
g2 <- which( FS == 0.5 )
g3 <- which( FS < 0.5 )
g4 <- which( is.na( FS ) )
group <- list( g1, g2, g3, g4 )
n.g <- length( group )
len_group <- rep( 0, n.g )
for ( i in 1:n.g ) len_group[i] <- length( group[[i]] )
x <- Rfast::standardise( as.matrix( data ) )
mod <- glm( y ~ x, binomial )
betas <- as.vector( mod$coefficients )
covs <- vcov( mod )
solvecovs <- solve( covs, tol = 1e-30 )
dm <- dim(x)
n <- dm[1] ; p <- dm[2]
newlambdastar <- lambdastar <- lambdasd <- lambdaaccept <- lambdacount <- accept <- logaccept <- sha <- gammasq <- newgammasq <- rep( 1, n.g )
newlambda <- list(999)
lambda <- list( rep( lambdastar[1], len_group[1] ), rep( lambdastar[2], len_group[2] ),
rep( lambdastar[3], len_group[3] ), rep( lambdastar[4], len_group[4] ) )
LAMBDA <- GAMMASQ <- rep( 1, p )
w <- 1
h <- 0
psi <- rep( 2 * lambda[[1]][1] * gammasq[1] * 0.01, p )
numbofits <- burnin + every * numb
holdpsi <- matrix( rep( 0, p * numb ), ncol = numb )
holdbeta <- matrix( rep( 0, p * numb ), ncol = numb )
holdgammasq <- matrix( rep( 0, n.g * numb ), ncol = numb )
holdlambda <- matrix( rep( 0, n.g * numb ), ncol = numb )
holdLAMacsept <- matrix( rep( 0, n.g * numb ), ncol = numb )
holdalpha <- numeric( numb )
holdW <- numeric( numb )
holdH <- numeric( numb )
lambdasd <- rep( 0.01, n.g )
const <- solvecovs %*% betas
for (i in 1:numbofits ){
LAM <- diag( c( 0, 1/psi ) )
covsLAM <- solvecovs + LAM
varstar <- solve( covsLAM )
expec <- varstar %*% const
cholstar <- chol( varstar, pivot = TRUE )
if ( attr( cholstar, "rank" ) == ncol( cholstar ) ) {
pivot <- attr( cholstar, "pivot" )
cholstar <- cholstar[ ,order( pivot ) ]
randn <- rnorm( p + 1 )
be <- expec + crossprod( cholstar, randn )
alpha <- be[1]
beta <- be[-1]
}
for (j in 1:p) {
if ( beta[j]^2 < 10^( -5 ) ) {
check <- 0
if ( LAMBDA[j] < 0.5 ) {
while ( check == 0 ) {
psi[j] <- 1 / rgamma( 1, 0.5 - LAMBDA[j], scale = 1 / ( 0.5 * beta[j]^2 ) )
u <- runif( 1 )
check <- as.numeric( u < exp(- psi[j] / ( 2 * GAMMASQ[j] ) ) ) }
} else {
while ( check == 0) {
psi[j] <- rgamma( 1, LAMBDA[j] - 0.5, scale = 2 * GAMMASQ[j] )
u <- runif( 1 )
check <- as.numeric( u < exp( - 0.5 * beta[j]^2 / psi[j] ) ) } }
} else { psi[j] <- rgig( 1, LAMBDA[j] - 0.5, beta[j]^2, 1 / GAMMASQ[j] ) }
}
psi[ psi < 1e-10 & psi != 0 ] <- 1e-10
for ( g in 1:n.g ) {
mupsi <- 2 * lambdastar[g] * gammasq[g]
newlambdastar[g] <- lambdastar[g] * exp( lambdasd[g] *rnorm( 1 ) )
newgammasq[g] <- mupsi / ( 2 * newlambdastar[g] )
newlambda[[g]] <- rep( newlambdastar[g], len_group[g] )
logaccept[g] <- log( newlambdastar[g] ) - log( lambdastar[g] ) - 142.85 * ( newlambdastar[g] - lambdastar[g] )
logaccept[g] <- logaccept[g] - len_group[g] * newlambdastar[g] * log( 2 * newgammasq[g] ) - len_group[g] * lgamma( newlambdastar[g] )
logaccept[g] <- logaccept[g] + len_group[g] * lambdastar[g] * log( 2 * gammasq[g] ) + len_group[g] * lgamma( lambdastar[g] )
logaccept[g] <- logaccept[g] + newlambdastar[g] * sum( log( psi[group[[g]]] ) ) - sum( psi[group[[g]]] ) / ( 2 * newgammasq[g] )
logaccept[g] <- logaccept[g] - lambdastar[g] * sum( log( psi[group[[g]]] ) ) +sum( psi[group[[g]]] ) / ( 2 * gammasq[g] )
accept[g] <- 1
if ( logaccept[g] < 0 ) { accept[g] <- exp( logaccept[g] ) }
lambdasd[g] <- lambdasd[g] + ( accept[g] - 0.3) / i
lambdaaccept[g] <- lambdaaccept[g] + accept[g]
lambdacount[g] <- lambdacount[g] + 1
u <- runif( 1 )
if ( u < accept[g] ) {
lambda[[g]] <- newlambda[[g]]
lambdastar[g] <- newlambdastar[g]
gammasq[g] <- newgammasq[g]
}
if (g == 1) {
sha[g] <- 0.5 * sum( psi[group[[g]]] ) + medstar[1] / ( 2 * lambdastar[g] )
gammasq[g] <- 1 / rgamma( 1, sum( unlist( lambda[[g]] ) ) + 2, scale = 1 / sha[g] )
} else if (g == 2) {
A <- 0.5 * sum( psi[group[[g]]] ) + medstar[1] / ( 2 * lambdastar[g] )
B <- 0.5 * sum( psi[group[[g]]] ) + medstar[2] / ( 2 * lambdastar[g] )
delta1 <- ( w * ( medstar[1])^2 ) / ( ( w * ( medstar[1])^2 ) + ( ( A / B )^( len_group[g] * lambdastar[g] + 2 ) * ( 1 - w ) * ( medstar[2])^2 ) )
U <- runif( 1 )
if ( U < delta1 ) {
sha[g] <- 0.5 * sum( psi[group[[g]]] ) + medstar[1] / ( 2 * lambdastar[g] )
gammasq[g] <- 1 / rgamma( 1, sum( unlist( lambda[[g]] ) ) + 2, scale = 1 / sha[g] )
} else {
sha[g] <- 0.5 * sum( psi[group[[g]]] ) + medstar[2] / ( 2 * lambdastar[g] )
gammasq[g] <- 1 / rgamma( 1, sum( unlist( lambda[[g]] ) ) + 2, scale = 1 / sha[g] )
}
} else if (g == 3) {
sha[g] <- 0.5 * sum( psi[group[[g]]] ) + medstar[2] / ( 2 * lambdastar[g] )
gammasq[g] <- 1 / rgamma( 1, sum( unlist( lambda[[g]] ) ) + 2, scale = 1 / sha[g] )
} else {
A <- 0.5 * sum( psi[group[[g]]] ) + medstar[1] / ( 2 * lambdastar[g] )
B <- 0.5 * sum( psi[group[[g]]] ) + medstar[2] / ( 2 * lambdastar[g] )
delta2 <- ( h * ( medstar[1])^2 ) / ( ( h * (medstar[1])^2 ) + ( ( A / B )^(len_group[g] * lambdastar[g] + 2) * ( 1 - h ) * ( medstar[2])^2 ) )
U <- runif( 1 )
if (U < delta2) {
sha[g] <- 0.5 * sum( psi[group[[g]]] ) + medstar[1] / ( 2 * lambdastar[g] )
gammasq[g] <- 1 / rgamma( 1, sum( unlist( lambda[[g]] ) ) + 2, scale = 1 / sha[g] )
} else {
sha[g] <- 0.5 * sum( psi[group[[g]]] ) + medstar[2] / ( 2 * lambdastar[g] )
gammasq[g] <- 1 / rgamma( 1, sum( unlist( lambda[[g]] ) ) + 2, scale = 1 / sha[g] )
}
}
}
LAMBDA <- unlist( lambda )[order( unlist( group ) )]
GAMMASQ <- c( rep( gammasq[1], len_group[1] ),rep( gammasq[2], len_group[2] ), rep(gammasq[3], len_group[3] ), rep( gammasq[4], len_group[4] ) )
GAMMASQ <- GAMMASQ[ order( unlist( group ) ) ]
U <- runif( 1 )
sha1 <- medstar[1] / ( 2 * lambdastar[2] )
sha2 <- medstar[2] / ( 2 * lambdastar[2] )
A <- dgamma( gammasq[2], 2, scale = 1 / ( sha1 ) )
B <- dgamma( gammasq[2], 2, scale = 1 / ( sha2 ) )
delta3 <- A / ( A + B )
if ( U < delta3 ) {
w <- rbeta( 1, 3, 2 )
} else {
w <- rbeta( 1, 2, 3 )
}
U <- runif( 1 )
sha1 <- medstar[1] / ( 2 * lambdastar[4] )
sha2 <- medstar[2] / ( 2 * lambdastar[4] )
A <- dgamma( gammasq[4], 2, scale = 1 / ( sha1 ) )
B <- dgamma( gammasq[4], 2, scale = 1 / ( sha2 ) )
delta4 <- A / ( A + ( 4 * B ) )
if ( U < delta4 ) {
h <- rbeta( 1, 2, 4 )
} else {
h <- rbeta( 1, 1, 5 )
}
if ( i > burnin & ( i - burnin ) %% every == 0 ) {
holdlambda[ , ( i - burnin ) / every ] <- lambdastar
holdgammasq[ , ( i - burnin ) / every ] <- gammasq
holdLAMacsept[ , ( i - burnin ) / every ] <- lambdaaccept
holdalpha[ ( i - burnin ) / every ] <- alpha
holdbeta[ , ( i - burnin ) / every ] <- beta
holdpsi[ , ( i - burnin ) / every ] <- psi
holdW[ ( i - burnin ) / every ] <- w
holdH[ ( i - burnin ) / every ] <- h
}
}
list( alpha = holdalpha, beta = holdbeta, psi = holdpsi, lambda = holdlambda,
gammasq = holdgammasq, H = holdH, W = holdW)
} |
is.r.package <- function(targz, spec=NULL, warn=TRUE)
{
contents <- untar(targz, list=TRUE)
if("DESCRIPTION" %in% sub(".*?/", "", contents))
{
ans <- TRUE
}
else if("DESCRIPTION" %in% basename(contents))
{
if(warn)
{
subdir <- basename(dirname(contents[basename(contents) == "DESCRIPTION"]))
suggestion <- if(is.null(spec)) NULL
else paste0(" - did you mean\n source = {", spec$username,
"/", spec$repo, "/", subdir, "@", spec$ref, "}")
warning(subdir, " looks like an R package inside a repository",
suggestion)
}
ans <- FALSE
}
else
{
ans <- FALSE
}
ans
} |
context("Append blobs")
tenant <- Sys.getenv("AZ_TEST_TENANT_ID")
app <- Sys.getenv("AZ_TEST_APP_ID")
password <- Sys.getenv("AZ_TEST_PASSWORD")
subscription <- Sys.getenv("AZ_TEST_SUBSCRIPTION")
if(tenant == "" || app == "" || password == "" || subscription == "")
skip("Authentication tests skipped: ARM credentials not set")
rgname <- Sys.getenv("AZ_TEST_STORAGE_RG")
storname <- Sys.getenv("AZ_TEST_STORAGE_NOHNS")
if(rgname == "" || storname == "")
skip("Append blob tests skipped: resource names not set")
sub <- AzureRMR::az_rm$new(tenant=tenant, app=app, password=password)$get_subscription(subscription)
stor <- sub$get_resource_group(rgname)$get_storage_account(storname)
bl <- stor$get_blob_endpoint()
opts <- options(azure_storage_progress_bar=FALSE)
test_that("Append blob works",
{
cont_name <- paste0(sample(letters, 10, TRUE), collapse="")
cont <- create_blob_container(bl, cont_name)
expect_silent(upload_blob(cont, "../resources/iris.csv", "iris.csv", type="AppendBlob", append=FALSE))
expect_true(blob_exists(cont, "iris.csv"))
expect_silent(upload_blob(cont, "../resources/iris.csv", "iris.csv", type="AppendBlob", append=TRUE))
expect_silent(upload_blob(cont, "../resources/iris.csv", "iris0.csv"))
expect_is(blobs <- list_blobs(cont, info="all"), "data.frame")
expect_identical(nrow(blobs), 2L)
appblob <- blobs[which(blobs$blobtype == "AppendBlob"), ]
blkblob <- blobs[which(blobs$blobtype == "BlockBlob"), ]
fsize <- file.size("../resources/iris.csv")
expect_true(nrow(appblob) == 1 && appblob$name == "iris.csv" && appblob$size == 2*fsize)
expect_true(nrow(blkblob) == 1 && blkblob$name == "iris0.csv")
expect_error(upload_blob(cont, "../resources/iris.csv", "iris0.csv", type="AppendBlob", append=TRUE))
expect_error(upload_blob(cont, "../resources/iris.csv", "iris0.csv", type="AppendBlob", append=FALSE))
dlfile <- tempfile()
download_blob(cont, "iris.csv", dlfile)
expect_true(file.size(dlfile) == 2*fsize)
dl <- readLines(dlfile)
src <- readLines("../resources/iris.csv")
n <- length(src)
expect_true(length(dl) == 2*n && identical(src, dl[1:n]) && identical(src, dl[(n+1):(2*n)]))
})
teardown(
{
options(opts)
conts <- list_blob_containers(bl)
lapply(conts, delete_blob_container, confirm=FALSE)
}) |
ellipseLexCA <- function (object, selWord="ALL",selDoc="ALL",
nbsample = 100, level.conf = 0.95, axes = c(1, 2), ncp=NULL, xlim = NULL, ylim = NULL, title=NULL,
col.doc = "blue", col.word = "red", col.doc.ell = col.doc,
col.word.ell = col.word, cex=1)
{
if (!inherits(object, "LexCA")) stop("Object should be LexCA class")
graph.type <- "classic"
options(stringsAsFactors = FALSE)
if(is.null(ncp)) ncp <- ncol(object$col$coord) else
ncp <- min(ncol(object$col$coord),ncp)
if(max(axes)> ncp) stop("Axis=" , max(axes), " is bigger than ncp=", ncp, ". Change ncp value in LexCA" )
selectionDW <- function(sel1, xobj,bType, axx, axy)
{
if(is.null(sel1)) { sel1<-c()
return(sel1)}
xx <- ""
if(length(sel1)==1){
if(sel1=="ALL") sel1 <- c(1:dim(xobj$coord)[1])
}
if(length(sel1)==1) {
if(sel1=="meta") sel1 <- "meta 3"
xx <- gregexpr(pattern =' ',sel1)[[1]][1]-1
xx <- substr(sel1, 1, xx)
}
if(xx=="coord" | xx=="cos2" | xx=="contrib" | xx=="meta" )
{
nc <- nchar(sel1)
if(xx=="coord") {
sel1 <- as.numeric(substr(sel1, 7, nc))
dft <- data.frame(xobj$coord[,c(axx,axy),drop=FALSE])
fval <- apply(dft, 1, function(x) max(abs(x)))
ordmax <- rank(fval)
posic <- which(ordmax > (length(fval)-sel1))
sel1 <- rownames(xobj$coord)[posic]
}
if(xx=="cos2") {
sel1 <- as.numeric(substr(sel1, 5, nc))
dft <- data.frame(xobj$cos2[,c(axx,axy),drop=FALSE])
fval <- apply(dft, 1, function(x) sum(x))
posic <- which(fval>= sel1)
sel1 <- rownames(xobj$cos2)[posic]
}
if(xx=="contrib") {
sel1 <- as.numeric(substr(sel1, 9, nc))
dft <- data.frame(xobj$contrib[,c(axx,axy),drop=FALSE])
fval <- apply(dft, 1, function(x) max(abs(x)))
posic <- which(fval>= sel1)
sel1 <- rownames(xobj$contrib)[posic]
}
if(xx=="meta") {
sel1 <- as.numeric(substr(sel1, 5, nc))
sKeys <- rownames(xobj$coord)[which(xobj$contrib[,axx]>mean(xobj$contrib[,axx])*sel1)]
sKeys <- c(sKeys,rownames(xobj$coord)[which(xobj$contrib[,axy]>mean(xobj$contrib[,axy])*sel1)])
sel1 <- unique(sKeys)
}
} else {
if(is.character(sel1)) sel1 <- which(rownames(xobj$coord) %in% sel1)
sel1 <- rownames(xobj$coord)[sel1]
sel1 <- sel1[!is.na(sel1)]
}
return(sel1)
}
X = object$call$X
if(!is.null(selDoc)) selDoc <- selectionDW(selDoc,object$row,"Doc",axes[1],axes[2])
if(!is.null(selWord)) selWord <- selectionDW(selWord, object$col,"Word",axes[1],axes[2])
if ( (length(selDoc) + length(selWord)) == 0)
stop("No elements are selected to be plotted;", "\n",
" verify the expression of both arguments selWord and/or selDoc")
concCol = X
concRow = X
sampcol=0
samprow=0
method <- "multinomial"
proba = unlist(c(X))
N = sum(proba)
proba = proba/N
aa = rmultinom(nbsample, size = N, prob = proba)
for (i in 1:nbsample) {
aux = matrix(aa[, i, drop = FALSE], nrow = nrow(X))
dimnames(aux) = dimnames(X)
if(!is.null(selWord))
{
aaa<-apply(aux,2,sum)
if (!(0 %in% aaa))
{
concCol = cbind.data.frame(concCol, aux)
} else {
sampcol<-sampcol+1
}
}
if(!is.null(selDoc))
{
bbb<-apply(aux,1,sum)
if (!(0 %in% bbb))
{
concRow = rbind.data.frame(concRow, aux)
} else {
samprow<-samprow+1
}
}
}
if ((!is.null(selWord)) & (sampcol/nbsample)>0.1 ) {
stop("over 10% of the replicated samples present words with null frequency","\n",
" it is advisable to increase the threshold on the word frequency in TextData") }
if ( (!is.null(selDoc)) & (samprow/nbsample)>0.1 ) {
stop("over 10% of the replicated samples present documents with null length","\n",
" it is advisable to increase the threshold on the word frequency in TextData") }
vdvword<-rep("transparent",ncol(X))
vdvword[which(colnames(X) %in% selWord)]<-col.word.ell
vdvdoc<-rep("transparent",nrow(X))
vdvdoc[which(rownames(X) %in% selDoc)]<-col.doc.ell
Xcoord.ellipse <- function (coord.simul, centre = NULL, axes = c(1, 2), level.conf = 0.95,
npoint = 100, bary = FALSE)
{
Xellipse <- function(x, scale = c(1, 1), centre = c(0, 0),
level = 0.95, t = sqrt(qchisq(level, 2)), which = c(1, 2), npoints = 100) {
names <- c("x", "y")
if (is.matrix(x)) {
xind <- which[1]
yind <- which[2]
r <- x[xind, yind]
if (missing(scale)) {
scale <- sqrt(c(x[xind, xind], x[yind, yind]))
if (scale[1] > 0)
r <- r/scale[1]
if (scale[2] > 0)
r <- r/scale[2]
}
if (!is.null(dimnames(x)[[1]]))
names <- dimnames(x)[[1]][c(xind, yind)]
}
else r <- x
r <- min(max(r, -1), 1)
d <- acos(r)
a <- seq(0, 2 * pi, len = npoints)
matrix(c(t * scale[1] * cos(a + d/2) + centre[1], t *
scale[2] * cos(a - d/2) + centre[2]), npoints, 2,
dimnames = list(NULL, names))
}
nbre.fact <- nlevels(coord.simul[, 1])
res <- label <- NULL
lev <- levels(coord.simul[, 1])
for (f in 1:nbre.fact) {
x <- coord.simul[which(coord.simul[, 1] == lev[f]), axes[1] + 1]
y <- coord.simul[which(coord.simul[, 1] == lev[f]), axes[2] + 1]
if (is.null(centre))
center <- c(mean(x, na.rm = TRUE), mean(y, na.rm = TRUE))
else {
if (ncol(coord.simul) != ncol(centre))
stop("ncol de centre incorrect")
if (!all.equal(lev, levels(centre[, 1])))
stop("Levels of centre are not corrects")
center <- as.numeric(centre[which(centre[, 1] ==levels(centre[, 1])[f]),
c(axes[1] + 1, axes[2] + 1)])
}
tab <- data.frame(x = x, y = y, stringsAsFactors = TRUE)
if (nrow(tab) > 1)
mat.cov <- cov(tab)
else mat.cov <- matrix(0, 4, ncol = 2)
if (bary)
mat.cov = mat.cov/nrow(tab)
elli.tmp <- Xellipse(mat.cov, centre = center,
level = level.conf, npoints = npoint)
res <- rbind(res, elli.tmp)
}
label <- factor(rep(lev, each = npoint), levels = lev)
result <- data.frame(facteur = label, res)
colnames(result)[1] = "facteur"
colnames(result) <- colnames(coord.simul)[c(1, axes + 1)]
return(list(res = result, call = npoint))
}
if (!is.null(selWord)) {
colCA <- FactoMineR::CA(concCol, col.sup = (ncol(X) + 1):ncol(concCol), graph = FALSE, ncp=ncp)
aux3 <- colCA$col.sup$coord[, axes]
rownames(aux3) <- paste("r", 1:nrow(aux3), sep = "")
aux1 <- cbind.data.frame(label=paste("word", 1:ncol(X), sep = ""), aux3)
aux1$label <- as.factor(aux1$label)
ellCol <- Xcoord.ellipse(aux1, level.conf = level.conf)$res
}
if (!is.null(selDoc)) {
rowCA = FactoMineR::CA(concRow, row.sup = (nrow(X) + 1):nrow(concRow), graph = FALSE, ncp=ncp)
aux2 = cbind.data.frame(label=paste("doc", 1:nrow(X), sep = ""),
rowCA$row.sup$coord[, axes])
aux2$label <- as.factor(aux2$label)
ellRow = Xcoord.ellipse(aux2, level.conf = level.conf)$res
}
if (is.null(xlim)) {
if ( (!is.null(selWord)) & (!is.null(selDoc)) )
xlim <- c(min(ellCol[, 2], ellRow[, 2]), max(ellCol[, 2], ellRow[, 2]))
else {
if (!is.null(selWord))
xlim <- c(min(ellCol[, 2]), max(ellCol[, 2]))
if (!is.null(selDoc))
xlim <- c(min(ellRow[, 2]), max(ellRow[, 2]))
}
}
if (is.null(ylim)) {
if ( (!is.null(selWord)) & (!is.null(selDoc)) )
ylim <- c(min(ellCol[, 3], ellRow[, 3]), max(ellCol[, 3], ellRow[, 3]))
else {
if (!is.null(selWord))
ylim <- c(min(ellCol[, 3]), max(ellCol[, 3]))
if (!is.null(selDoc))
ylim <- c(min(ellRow[, 3]), max(ellRow[, 3]))
}
}
if ( (!is.null(selWord)) & (!is.null(selDoc)) )
plot.LexCA(object, axes = axes, selWord=selWord,selDoc=selDoc,xlim = xlim, ylim = ylim, col.doc = col.doc, col.word = col.word,
cex=cex,title=title, graph.type =graph.type, plot.new=TRUE)
else {
if (!is.null(selWord))
plot.LexCA(object, axes = axes, selWord=selWord,selDoc=NULL,xlim = xlim, ylim = ylim, col.word = col.word,cex=cex,title=title,
graph.type =graph.type, plot.new=TRUE)
if (!is.null(selDoc))
plot.LexCA(object, axes = axes, selWord=NULL,selDoc=selDoc,xlim = xlim, ylim = ylim, col.doc = col.doc,,cex=cex,title=title,
graph.type =graph.type, plot.new=TRUE)
}
if (!is.null(selDoc)) {
lev <- paste("doc", 1:nlevels(ellRow[, 1]), sep = "")
for (e in 1:nlevels(ellRow[, 1])) {
data.elli <- ellRow[ellRow[, 1] == lev[e], -1]
lines(x = data.elli[, 1], y = data.elli[, 2], col = vdvdoc[e])
}
}
if (!is.null(selWord)) {
lev <- paste("word", 1:nlevels(ellCol[, 1]), sep = "")
for (e in 1:nlevels(ellCol[, 1])) {
data.elli <- ellCol[ellCol[, 1] == lev[e], -1]
lines(x = data.elli[, 1], y = data.elli[, 2], col = vdvword[e])
}
}
} |
validateUnitedSim <- function(object) {
errors <- character()
if (length(errors) == 0) TRUE else errors
}
setClass("unitedSim",
slots = c(results = "data.frame", averageTrainingPointsHome = "numeric",
averageTrainingPointsAway = "numeric", averagePointsHome = "numeric",
averagePointsAway = "numeric", winProbabilityHome = "numeric",
winProbabilityAway = "numeric", tiedProbability = "numeric",
averageRedCardsHome = "numeric", averageRedCardsAway = "numeric",
home = "formation", away = "formation"),
validity = validateUnitedSim)
setClass("unitedSimR",
slots = c(r = "numeric"),
contains = "unitedSim")
setMethod("summary", signature(object = "unitedSim"), function(object) {
names <- slotNames(object)
names <- names[!(names %in% c("results", "home", "away"))]
value <- numeric(length(names) + 2)
lineupHome <- toString(getLineup(object@home))
value[1] <- lineupHome <- gsub(", ", "-", lineupHome)
lineupAway <- toString(getLineup(object@away))
value[2] <- gsub(", ", "-", lineupAway)
for (i in 1:length(names)) {
value[i+2] <- slot(object, names[i])
}
D <- as.data.frame(t(data.frame(value)))
colnames(D) <- c("home", "away", names)
rownames(D) <- 1
for (i in 1:2) {
D[ ,i] <- as.character(D[ ,i])
}
for (i in 3:ncol(D)) {
D[ ,i] <- as.numeric(as.character(D[ ,i]))
}
D
}
)
setMethod("show", "unitedSim", function(object) {
cat("\n")
cat("Used lineup home was:\n")
lineupHome <- toString(getLineup(object@home))
lineupHome <- gsub(", ", "-", lineupHome)
cat("\t", lineupHome)
cat("\n")
cat("Used lineup away was:\n")
lineupAway <- toString(getLineup(object@away))
lineupAway <- gsub(", ", "-", lineupAway)
cat("\t", lineupAway)
cat("\n\nThe key statistics are:\n")
names <- slotNames(object)
names <- names[!(names %in% c("results", "home", "away"))]
for (name in names) {
cat("\t", name, "=", round(slot(object, name), digits = 4), "\n")
}
cat("\nThe most probable results are:\n")
if (nrow(object@results) >= 6) {
print(round(object@results[1:6, c(1:4, 9, 10)], digits = 3), row.names = FALSE)
} else {
print(round(object@results[, c(1:4, 9, 10)], digits = 3), row.names = FALSE)
}
cat("\n")
}
)
setMethod("show", "unitedSimR", function(object) {
cat("\n")
cat("Used lineup home was:\n")
lineupHome <- toString(getLineup(object@home))
lineupHome <- gsub(", ", "-", lineupHome)
cat("\t", lineupHome)
cat("\n")
cat("Used lineup away was:\n")
lineupAway <- toString(getLineup(object@away))
lineupAway <- gsub(", ", "-", lineupAway)
cat("\t", lineupAway)
cat("\n\nThe key statistics based on", object@r,"simulations are:\n")
names <- slotNames(object)
names <- names[!(names %in% c("results", "home", "away", "r"))]
for (name in names) {
cat("\t", name, "=", slot(object, name), "\n")
}
cat("\nThe most probable results are:\n")
if (nrow(object@results) >= 6) {
print(round(object@results[1:6, c(1:4, 9, 10)], digits = 3), row.names = FALSE)
} else {
print(round(object@results[, c(1:4, 9, 10)], digits = 3), row.names = FALSE)
}
cat("\n")
}
) |
library(tidyverse)
library(ggforce)
curves <- expand.grid(
x = 3.1 * seq(-3, 3, 2),
y = 1.55 * seq(-5, 5, 4)
) %>%
rowwise() %>%
mutate(
x = list(x + 1.55 * -1:3),
y = list(y + 1.55 * -1:3)
) %>%
unnest(c(x, y)) %>%
group_by(x)
ggplot() +
geom_arc(data = subset(curves, x < 7), aes(x0 = x, y0 = y, r = 2.19, start = if_else(y > 7, 0, pi/4), end = if_else(y < -7, pi, 3 * pi/4)), color = "grey10") +
geom_arc(data = subset(curves, x > -7), aes(x0 = x, y0 = y, r = 2.19, start = if_else(y > 7, 0, -pi/4), end = if_else(y < -7, -pi, -3 * pi/4)), color = "grey10") +
geom_circle(data = NULL, aes(x0 = 0, y0 = seq(-9.3, 9.3, length.out = 7), r = 0.63), color = "grey10") +
annotate("tile", x = 0, y = 0, width = 20, height = 20, color = "grey10", fill = NA, size = 0.5) +
xlim(-10, 10) +
ylim(-10, 10) +
coord_fixed(expand = FALSE, clip = "off") +
theme_void() +
theme(
plot.margin = margin(20, 20, 20, 20),
plot.background = element_rect(fill = "grey97", color = NA)
)
ggsave(here::here("plots", "edna-arcs.png"), height = 5, width = 5) |
model2netcdf.CLM45 <- function(outdir, sitelat, sitelon, start_date, end_date) {
} |
rocChart <- function(pr, target)
{
rates <- pr %>%
ROCR::prediction(target) %>%
ROCR::performance("tpr", "fpr")
auc <- pr %>%
ROCR::prediction(target) %>%
ROCR::performance("auc") %>%
attr("y.values") %>%
magrittr::extract2(1)
pl <- data.frame(tpr=attr(rates, "y.values")[[1]],
fpr=attr(rates, "x.values")[[1]]) %>%
ggplot2::ggplot(ggplot2::aes(fpr, tpr)) +
ggplot2::geom_line() +
ggplot2::annotate("text", x=0.875, y=0.125, vjust=0,
label=paste("AUC =", round(100*auc, 2)),
family="xkcd") +
ggplot2::xlab("False Positive Rate (1-Specificity)") +
ggplot2::ylab("True Positive Rate (Sensitivity)")
attr(pl, "auc") <- auc
return(pl)
} |
vname <- function(x) {
paste0(deparse(eval.parent(substitute(substitute(x))), width.cutoff = 500L),
collapse = "\n")
} |
domain_categorical <- function(allowed) {
list(type = "categorical",
allowed = allowed) -> range
class(range) <- c("value_range", class(range))
range
} |
do_admb <- function(fn,
data=NULL,
params=NULL,
bounds=NULL,
phase=NULL,
re=NULL,
data_type=NULL,
safe=TRUE,
profile=NULL,
profile.opts=NULL,
mcmc=NULL,
mcmc.opts=mcmc.control(),
impsamp=FALSE,
verbose=FALSE,
run.opts=run.control(),
objfunname="f",
workdir=getwd(),
admb_errors=c("stop","warn","ignore"),
extra.args) {
admb_errors <- match.arg(admb_errors)
if (!missing(workdir)) {
file.copy(list.files(pattern=paste(fn,"\\.(dat|pin|tpl)",sep="")),
workdir)
cwd <- setwd(workdir)
on.exit(setwd(cwd))
}
if (is.null(data) && is.null(params) && missing(run.opts)) {
checkparam <- checkdata <- "ignore"
} else {
checkparam <- run.opts["checkparam"]
checkdata <- run.opts["checkdata"]
}
if (is.null(mcmc)) mcmc <- !missing(mcmc.opts)
if (mcmc) {
if (checkparam=="write" && !"mcmcpars" %in% names(mcmc.opts))
stop("must specify mcmcpars when checkparam=='write' and mcmc is TRUE")
}
if (is.null(profile)) profile <- !missing(profile.opts)
if (profile & !is.null(re)) {
stop("profiling is not implemented for models with random effects")
}
if (profile && is.null(profile.opts$pars) && checkparam=="write")
stop("must specify profpars when checkparam=='write' and profile is TRUE")
if (is.null(re)) {
if (mcmc && "mcmc2" %in% names(mcmc.opts)) stop("mcmc2 can only be used with random-effects models")
}
tplfile <- paste(fn,"tpl",sep=".")
if (!file.exists(tplfile)) stop("can't find TPL file ",tplfile)
if (run.opts["check_tpl"]) {
tpldat <- read_tpl(fn)
tplinfo <- tpldat$info
orig_tplfile <- tplfile
ofn <- fn
if (test_OScase() && !tolower(fn)==fn) {
warning("Base name converted to lower case for ADMB compatibility: copying TPL file")
tplfile <- tolower(tplfile)
fn <- tolower(fn)
file.copy(orig_tplfile,tplfile,overwrite=TRUE)
}
getvals <- function(L,el="bounds",getFirst=FALSE,valsOK) {
res <- lapply(L,function(x) {
if (is.list(x)) {
if (is.null(x[[el]]) && getFirst) {
x[[1]]
} else x[[el]]
} else {
if (valsOK) x else NULL
}
})
res <- res[!sapply(res,is.null)]
if (length(res)==0) res <- NULL
res
}
if (!checkparam %in% c("write","ignore") && is.null(tplinfo$inits))
stop("must specify PARAMETER section (or set 'checkparam' to 'write' or 'ignore')")
if (checkparam!="ignore") {
if (missing(bounds)) bounds <- getvals(params,"bounds",valsOK=FALSE)
if (missing(phase)) phase <- getvals(params,"phase",valsOK=FALSE)
if (any(unlist(lapply(params,names))=="re")) {
params <- lapply(params,
function(x) {
if ("re" %in% names(x)) {
len <- if ("value" %in% names(x)) {
length(x[["value"]])
} else if (names(x)[1]=="") {
length(x[[1]])
} else stop("first element must be unnamed or 'value' must be specified")
x[["re"]] <- len
}
x
})
}
if (missing(re)) re <- getvals(params,"re",valsOK=FALSE)
params <- getvals(params,"value",getFirst=TRUE,valsOK=TRUE)
dmsg <- check_section(ofn,tpldat,"inits",params,
check=checkparam,
bounds=bounds,
data_type=data_type,
phase=phase,
secname="PARAMETER",
objfunname=objfunname,
re=re,
mcmcpars=mcmc.opts$mcmcpars,
profpars=profile.opts$pars)
}
if (!checkparam %in% c("write","ignore") && nchar(dmsg)>0) {
if (checkparam=="stop") stop(dmsg)
if (checkparam=="warn") warning(dmsg)
} else if (checkparam=="write") {
if (!is.null(tpldat$secs$PARAMETER)) {
tpldat$secs$PARAMETER <- dmsg
} else {
tpldat$secs <- append(tpldat$secs,list(PARAMETER=c(dmsg,"")),
after=which(names(tpldat$secs)=="PROCEDURE")-1)
}
if (mcmc) {
mcmcparnames <- gsub("^ +sdreport_(number|vector) r_","",
gsub("\\(.*$","",
dmsg[grep("^ +sdreport",dmsg)]))
if (length(mcmcparnames)>0) {
tpldat$secs$PROCEDURE <- append(tpldat$secs$PROCEDURE,
indent(paste("r_",mcmcparnames,"=",mcmcparnames,";",sep="")))
}
}
if (profile) {
profparnames <- gsub("^ +likeprof_number p_","",
gsub("\\(.*$","",
dmsg[grep("^ +likeprof_",dmsg)]))
tpldat$secs$PROCEDURE <- append(tpldat$secs$PROCEDURE,
indent(paste("p_",profparnames,"=",profparnames,";",sep="")))
}
}
if (checkdata!="ignore") {
dframes <- sapply(data,data.class)=="data.frame"
if (any(dframes)) warning("attempted to convert data frame to matrix")
data[dframes] <- lapply(data[dframes],as.matrix)
}
if (!checkdata %in% c("write","ignore") && is.null(tplinfo$data))
stop("must specify DATA section (or set 'checkdata' to 'write' or 'ignore')")
if (checkdata != "ignore") {
dmsg <- check_section(ofn,tpldat,"data",data,
check=checkdata,
data_type=data_type,
secname="DATA")
if (!checkdata %in% c("write","ignore") && nchar(dmsg)>0) {
if (checkdata=="stop") stop(dmsg)
if (checkdata=="warn") warning(dmsg)
} else if (checkdata=="write") {
if (!is.null(tpldat$secs$DATA)) {
tpldat$secs$DATA <- dmsg
} else {
tpldat$secs <- append(tpldat$secs,list(DATA=c(dmsg,"")),
after=which(names(tpldat$secs)=="PARAMETER")-1)
}
}
}
if (checkdata=="write" || checkparam=="write") {
parnames <- c(names(data),names(params))
badnames <- grep("\\.",parnames)
if (length(badnames)>0) {
for (i in badnames) {
old <- parnames[i]
new <- gsub("\\.","_",parnames[i])
tpldat$secs$PROCEDURE <- gsub(old,new,tpldat$secs$PROCEDURE)
}
}
fn <- paste(fn,"_gen",sep="")
tplfile <- paste(fn,".tpl",sep="")
writeLines(do.call("c",tpldat$secs),con=tplfile)
tpldat <- read_tpl(fn)
}
}
if (run.opts["write_files"]) {
if (verbose) cat("writing data and parameter files ...\n")
dat_write(fn,data)
if (!is.null(re)) {
rv <- re[!names(re) %in% names(params)]
params <- c(params,lapply(as.list(rv),rep,x=0))
}
pin_write(fn,params)
}
if (run.opts["compile"]) {
compile_admb(fn,safe,re=!is.null(re),verbose)
}
if (run.opts["run"]) {
res <- run_admb(fn,verbose,mcmc,mcmc.opts,profile,extra.args,admb_errors)
} else res <- NULL
if (run.opts["read_files"]) {
L <- read_admb(fn,verbose,
profile,
mcmc,
admbOut=res)
}
on.exit(clean_admb(fn,run.opts["clean_files"]),add=TRUE)
if (run.opts["read_files"]) L else NULL
}
test_OScase <- function(dir=getwd()) {
fn1 <- tempfile(tmpdir=dir)
fn2 <- gsub("/([^/]+)$","/\\U\\1",fn1,perl=TRUE)
if (!file.create(fn1)) stop("can't create temporary file")
res <- file.copy(fn1,fn2)
unlink(fn1)
unlink(fn2)
res
} |
makePhyloTree <- function(Edges, Lengths, Root) {
G <- graph(edges=t(Edges))
orderT <- graph.dfs(G,Root)$order
newLengths=0*Lengths
oE<-order(Edges[,2])
Edges <- Edges[oE, ]
Lengths <-Lengths[oE]
newEdges <- matrix(NA, nrow(Edges), ncol(Edges))
ooT<-order(orderT[-1]);
newEdges[ooT,] <- Edges
newLengths[ooT]= Lengths
Nnode <- (length(orderT)-1)/2;
Ntips <- Nnode+1;
pt <- rtree(Ntips);
pt$Nnode <- Nnode;
pt$edge <- newEdges;
pt$edge.length=newLengths;
pt$tip.label=paste("t",1:Ntips,sep="")
return(pt)
} |
"bsaqdpm" <- function(formula, xmin, xmax, p, nbasis, nint, mcmc = list(), prior = list(), egrid, ngrid = 500,
shape = c("Free", "Increasing", "Decreasing", "IncreasingConvex", "DecreasingConcave",
"IncreasingConcave", "DecreasingConvex", "IncreasingS", "DecreasingS",
"IncreasingRotatedS", "DecreasingRotatedS", "InvertedU", "Ushape"),
verbose = FALSE) {
cl <- match.call()
if (missing(p)) {
p <- 0.5
} else {
if (p <= 0 || p >= 1) {
stop("p must be in (0,1).\n")
}
}
ywxdata <- interpret.bsam(formula)
yobs <- ywxdata[[1]]
yname <- ywxdata[[2]]
wdata <- ywxdata[[3]]
wnames <- ywxdata[[4]]
xobs <- ywxdata[[5]]
xname <- ywxdata[[6]]
nobs <- nrow(yobs)
nparw <- ncol(wdata)
ndimw <- nparw - 1
if (missing(nbasis))
stop("The number of basis functions are specified by user.")
fshape <- function.shape(shape)
fmodel <- fshape$fmodel
fpm <- fshape$fpm
nfun <- fshape$nfun
if (nfun != ncol(xobs))
stop("The number of shape and columns of x should be same.")
if (missing(nint)) {
nint <- 200
}
if (missing(xmin)) {
xmin <- apply(xobs, 2, min)
} else {
if (nfun != length(xmin))
stop("The number of shape and length of xmin should be same.")
}
if (missing(xmax)) {
xmax <- apply(xobs, 2, max)
} else {
if (nfun != length(xmax))
stop("The number of shape and length of xmax should be same.")
}
xmid <- (xmin + xmax)/2
xrange <- xmax - xmin
xdelta <- (xrange)/nint
xgrid <- matrix(0, nrow = nint + 1, ncol = nfun)
for (i in 1:nfun) {
xgrid[, i] <- seq(xmin[i], by = xdelta[i], length = nint + 1)
}
if (missing(egrid)) {
egrid <- seq(-10, 10, length = ngrid)
} else {
ngrid <- length(egrid)
}
privals <- list(iflagprior = 0, theta0_m0 = 0, theta0_s0 = 100, tau2_m0 = 1, tau2_v0 = 100, w0 = 2, beta_m0 = numeric(nparw),
beta_v0 = diag(100, nparw), sigma2_r0 = 4, sigma2_s0 = 0.04 * range(yobs)^2, alpha_m0 = 3, alpha_s0 = 50, iflagpsi = 1,
psifixed = 100, omega_m0 = (xmin + xmax)/2, omega_s0 = xrange/8, tmass_a = 2, tmass_b = 4)
privals[names(prior)] <- prior
iflagprior <- privals$iflagprior
theta0_m0 <- privals$theta0_m0
theta0_s0 <- privals$theta0_s0
tau2_m0 <- privals$tau2_m0
tau2_v0 <- privals$tau2_v0
w0 <- privals$w0
beta_m0 <- privals$beta_m0
beta_v0 <- privals$beta_v0
sigma2_m0 <- privals$sigma2_m0
sigma2_v0 <- privals$sigma2_v0
alpha_m0 <- privals$alpha_m0
alpha_s0 <- privals$alpha_s0
iflagpsi <- privals$iflagpsi
psifixed <- privals$psifixed
psi_m0 <- psifixed
psi_s0 <- 10 * psifixed
omega_m0 <- privals$omega_m0
omega_s0 <- privals$omega_s0
sigma2_r0 <- privals$sigma2_r0
sigma2_s0 <- privals$sigma2_s0
tmass_a <- privals$tmass_a
tmass_b <- privals$tmass_b
mcvals <- list(nblow0 = 1000, nblow = 10000, smcmc = 1000, nskip = 10, ndisp = 1000, maxmodmet = 5)
mcvals[names(mcmc)] <- mcmc
nblow0 <- mcvals$nblow0
nblow <- mcvals$nblow
smcmc <- mcvals$smcmc
nskip <- mcvals$nskip
ndisp <- mcvals$ndisp
maxmodmet <- mcvals$maxmodmet
if (max(fmodel) == 1)
maxmodmet <- 0
mcmctime <- system.time({
foo <- .Fortran("bsaqamdpscale", as.integer(verbose), as.double(yobs), as.matrix(wdata), as.matrix(xobs), as.double(egrid), as.integer(nobs),
as.integer(ngrid), as.integer(nparw), as.integer(nfun), as.integer(nbasis), as.integer(nint), as.integer(fmodel),
as.double(fpm), as.double(p), as.double(theta0_m0), as.double(theta0_s0), as.double(tau2_m0), as.double(tau2_v0),
as.double(w0), as.double(beta_m0), as.matrix(beta_v0), as.double(alpha_m0), as.double(alpha_s0), as.double(psi_m0),
as.double(psi_s0), as.double(psifixed), as.double(omega_m0), as.double(omega_s0), as.double(sigma2_r0), as.double(sigma2_s0),
as.double(tmass_a), as.double(tmass_b), as.integer(iflagprior), as.integer(iflagpsi), as.integer(maxmodmet), as.integer(nblow0),
as.integer(nblow), as.integer(smcmc), as.integer(nskip), as.integer(ndisp), zetag = matrix(0, smcmc, nfun),
tau2g = matrix(0, smcmc, nfun), gammag = matrix(0, smcmc, nfun), thetag = array(0, dim = c(nbasis + 1, nfun, smcmc)),
betag = matrix(0, smcmc, nparw), alphag = matrix(0, smcmc, nfun), sigma2g = matrix(0, nrow = smcmc, ncol = nobs),
psig = matrix(0, smcmc, nfun), omegag = matrix(0, smcmc, nfun), nug = matrix(0, smcmc, nobs),
fxgridg = array(0, dim = c(nint + 1, nfun, smcmc)), fxobsg = array(0, dim = c(nobs, nfun, smcmc)),
yestg = matrix(0, smcmc, nobs), wbg = matrix(0, smcmc, nobs), tmassg = numeric(smcmc), config = as.integer(matrix(0, smcmc, nobs)),
nclassg = as.integer(numeric(smcmc)), edensg = matrix(0, smcmc, ngrid), invlikeg = matrix(0, nrow = smcmc, ncol = nobs),
imodmetg = as.integer(numeric(1)), pmetg = numeric(nfun), NAOK = TRUE, PACKAGE = "bsamGP")
})
mcmc.draws <- list()
mcmc.draws$zeta <- foo$zetag
mcmc.draws$tau2 <- foo$tau2g
mcmc.draws$tau <- apply(foo$tau2g, 2, sqrt)
mcmc.draws$alpha <- foo$alphag
mcmc.draws$psi <- foo$psig
mcmc.draws$omega <- foo$omegag
mcmc.draws$gamma <- foo$gammag
mcmc.draws$lngamma <- apply(foo$gammag, 2, log)
mcmc.draws$theta <- foo$thetag
mcmc.draws$beta <- foo$betag
mcmc.draws$sigma2 <- foo$sigma2g
mcmc.draws$nu <- foo$nug
dpm.draws <- list()
dpm.draws$tmass <- foo$tmassg
dpm.draws$config <- foo$config
dpm.draws$nclass <- foo$nclassg
dpm.draws$edens <- foo$edensg
dpm.draws$egrid <- egrid
dpm.draws$ngrid <- ngrid
lik.draws <- list()
lik.draws$invlike <- foo$invlikeg
fit.draws <- list()
fit.draws$xgrid <- xgrid
fit.draws$fxobs <- foo$fxobsg
fit.draws$fxgrid <- foo$fxgridg
fit.draws$yhat <- foo$yestg
fit.draws$wbeta <- foo$wbg
post.est <- list()
betam <- apply(foo$betag, 2, mean)
betas <- apply(foo$betag, 2, sd)
post.est$betam <- betam
post.est$betas <- betas
sigma2m <- colMeans(foo$sigma2g)
sigma2s <- apply(foo$sigma2g, 2, sd)
post.est$sigma2m <- sigma2m
post.est$sigma2s <- sigma2s
thetam <- apply(foo$thetag, c(1, 2), mean)
thetas <- apply(foo$thetag, c(1, 2), sd)
post.est$thetam <- thetam
post.est$thetas <- thetas
tau2m <- colMeans(foo$tau2g)
tau2s <- apply(foo$tau2g, 2, sd)
post.est$tau2m <- tau2m
post.est$tau2s <- tau2s
taug <- sqrt(foo$tau2g)
taum <- colMeans(taug)
taus <- apply(taug, 2, sd)
post.est$taum <- taum
post.est$taus <- taus
gammam <- colMeans(foo$gammag)
gammas <- apply(foo$gammag, 2, sd)
post.est$gammam <- gammam
post.est$gammas <- gammas
alpham <- colMeans(foo$alphag)
alphas <- apply(foo$alphag, 2, sd)
post.est$alpham <- alpham
post.est$alphas <- alphas
psim <- colMeans(foo$psig)
psis <- apply(foo$psig, 2, sd)
post.est$psim <- psim
post.est$psis <- psis
omegam <- colMeans(foo$omegag)
omegas <- apply(foo$omegag, 2, sd)
post.est$omegam <- omegam
post.est$omegas <- omegas
zetam <- colMeans(foo$zetag)
zetas <- apply(foo$zetag, 2, sd)
post.est$zetam <- zetam
post.est$zetas <- zetas
ym <- colMeans(foo$yestg)
rsquarey <- cor(cbind(yobs, ym))^2
rsquarey <- rsquarey[1, 2]
res.out <- list()
res.out$call <- cl
res.out$model <- "bsaqdpm"
res.out$y <- yobs
res.out$w <- wdata
res.out$x <- xobs
res.out$p <- p
res.out$xmin <- xmin
res.out$xmax <- xmax
res.out$n <- nobs
res.out$ndimw <- ndimw
res.out$nparw <- nparw
res.out$nint <- nint
res.out$nbasis <- nbasis
res.out$location <- FALSE
res.out$yname <- yname
res.out$wnames <- wnames
res.out$xname <- xname
res.out$shape <- shape
res.out$fshape <- fshape
res.out$fmodel <- fmodel
res.out$fpm <- fpm
res.out$nfun <- nfun
res.out$prior <- privals
res.out$mcmctime <- mcmctime
res.out$mcmc <- mcvals
res.out$pmet <- foo$pmetg
res.out$imodmet <- foo$imodmetg
res.out$mcmc.draws <- mcmc.draws
res.out$fit.draws <- fit.draws
res.out$lik.draws <- lik.draws
res.out$dpm.draws <- dpm.draws
res.out$post.est <- post.est
res.out$rsquarey <- rsquarey
res.out$cpo <- 1/colMeans(foo$invlikeg)
res.out$lpml <- sum(log(res.out$cpo))
class(res.out) <- "bsamdpm"
res.out
} |
get_DOIs = function (abs){ result = lapply(abs@Abstract,function(x){temp1 = SentenceToken(x); temp2 = grep("[Dd][Oo][Ii]: 10.[1234567890][1234567890][1234567890][1234567890]", temp1, value = T); temp3 = unlist(strsplit(temp2," ")); temp4 = regexpr("[Dd][Oo][Ii]:",temp3);temp5 = which(temp4 != -1);temp6 = temp5 + 1; temp7 = temp3[temp6]; temp8 = paste(temp3[temp5],temp7,sep = " ") ;if (length(temp8) != 0) { temp9 = unlist(lapply(temp8,function(x){if (substr(x,nchar(x),nchar(x)) == ".") return(substr(x,1,(nchar(x)-1))) else return(x)}));temp10 = toupper(temp9);temp11 = union(temp10,temp10) ;return(temp11)} else return("DOI Absent") })} |
config <- list(
activate.prompt = function(..., default = TRUE) {
renv_config_get(
name = "activate.prompt",
type = "logical[1]",
default = default,
args = list(...)
)
},
autoloader.enabled = function(..., default = TRUE) {
renv_config_get(
name = "autoloader.enabled",
type = "logical[1]",
default = default,
args = list(...)
)
},
auto.snapshot = function(..., default = FALSE) {
renv_config_get(
name = "auto.snapshot",
type = "logical[1]",
default = default,
args = list(...)
)
},
bitbucket.host = function(..., default = "api.bitbucket.org/2.0") {
renv_config_get(
name = "bitbucket.host",
type = "character[1]",
default = default,
args = list(...)
)
},
copy.method = function(..., default = "auto") {
renv_config_get(
name = "copy.method",
type = "*",
default = default,
args = list(...)
)
},
connect.timeout = function(..., default = 20L) {
renv_config_get(
name = "connect.timeout",
type = "integer[1]",
default = default,
args = list(...)
)
},
connect.retry = function(..., default = 3L) {
renv_config_get(
name = "connect.retry",
type = "integer[1]",
default = default,
args = list(...)
)
},
cache.enabled = function(..., default = TRUE) {
renv_config_get(
name = "cache.enabled",
type = "logical[1]",
default = default,
args = list(...)
)
},
cache.symlinks = function(..., default = .Platform$OS.type == "unix") {
renv_config_get(
name = "cache.symlinks",
type = "logical[1]",
default = default,
args = list(...)
)
},
dependency.errors = function(..., default = "reported") {
renv_config_get(
name = "dependency.errors",
type = "character[1]",
default = default,
args = list(...)
)
},
exported.functions = function(..., default = "*") {
renv_config_get(
name = "exported.functions",
type = "character[*]",
default = default,
args = list(...)
)
},
external.libraries = function(..., default = NULL) {
renv_config_get(
name = "external.libraries",
type = "character[*]",
default = default,
args = list(...)
)
},
filebacked.cache = function(..., default = TRUE) {
renv_config_get(
name = "filebacked.cache",
type = "logical[1]",
default = default,
args = list(...)
)
},
github.host = function(..., default = "api.github.com") {
renv_config_get(
name = "github.host",
type = "character[1]",
default = default,
args = list(...)
)
},
gitlab.host = function(..., default = "gitlab.com") {
renv_config_get(
name = "gitlab.host",
type = "character[1]",
default = default,
args = list(...)
)
},
hydrate.libpaths = function(..., default = NULL) {
renv_config_get(
name = "hydrate.libpaths",
type = "character[*]",
default = default,
args = list(...)
)
},
install.build = function(..., default = TRUE) {
renv_config_get(
name = "install.build",
type = "logical[1]",
default = default,
args = list(...)
)
},
install.shortcuts = function(..., default = TRUE) {
renv_config_get(
name = "install.shortcuts",
type = "logical[1]",
default = default,
args = list(...)
)
},
install.staged = function(..., default = TRUE) {
renv_config_get(
name = "install.staged",
type = "logical[1]",
default = default,
args = list(...)
)
},
install.transactional = function(..., default = TRUE) {
renv_config_get(
name = "install.transactional",
type = "logical[1]",
default = default,
args = list(...)
)
},
install.verbose = function(..., default = FALSE) {
renv_config_get(
name = "install.verbose",
type = "logical[1]",
default = default,
args = list(...)
)
},
locking.enabled = function(..., default = FALSE) {
renv_config_get(
name = "locking.enabled",
type = "logical[1]",
default = default,
args = list(...)
)
},
mran.enabled = function(..., default = TRUE) {
renv_config_get(
name = "mran.enabled",
type = "logical[1]",
default = default,
args = list(...)
)
},
pak.enabled = function(..., default = FALSE) {
renv_config_get(
name = "pak.enabled",
type = "logical[1]",
default = default,
args = list(...)
)
},
repos.override = function(..., default = NULL) {
renv_config_get(
name = "repos.override",
type = "character[*]",
default = default,
args = list(...)
)
},
rspm.enabled = function(..., default = TRUE) {
renv_config_get(
name = "rspm.enabled",
type = "logical[1]",
default = default,
args = list(...)
)
},
sandbox.enabled = function(..., default = FALSE) {
renv_config_get(
name = "sandbox.enabled",
type = "logical[1]",
default = default,
args = list(...)
)
},
shims.enabled = function(..., default = TRUE) {
renv_config_get(
name = "shims.enabled",
type = "logical[1]",
default = default,
args = list(...)
)
},
snapshot.validate = function(..., default = TRUE) {
renv_config_get(
name = "snapshot.validate",
type = "logical[1]",
default = default,
args = list(...)
)
},
startup.quiet = function(..., default = NULL) {
renv_config_get(
name = "startup.quiet",
type = "logical[1]",
default = default,
args = list(...)
)
},
synchronized.check = function(..., default = TRUE) {
renv_config_get(
name = "synchronized.check",
type = "logical[1]",
default = default,
args = list(...)
)
},
updates.check = function(..., default = FALSE) {
renv_config_get(
name = "updates.check",
type = "logical[1]",
default = default,
args = list(...)
)
},
updates.parallel = function(..., default = 2L) {
renv_config_get(
name = "updates.parallel",
type = "*",
default = default,
args = list(...)
)
},
user.environ = function(..., default = TRUE) {
renv_config_get(
name = "user.environ",
type = "logical[1]",
default = default,
args = list(...)
)
},
user.library = function(..., default = FALSE) {
renv_config_get(
name = "user.library",
type = "logical[1]",
default = default,
args = list(...)
)
},
user.profile = function(..., default = FALSE) {
renv_config_get(
name = "user.profile",
type = "logical[1]",
default = default,
args = list(...)
)
}
) |
biomarker_keywords <- c('circulating', 'biomarker', 'bio-marker',
'extracellular vesicles','urine',
'urinary', 'exosomes', 'exosomal',
'body fluid', "bodyfluid", 'diagnostic', 'biological marker',
'biomarker', 'bio-marker', 'biomarker',
'bio-marker', 'serum', 'plasma')
calculate_score_biomarker<- function(df,
keywords = biomarker_keywords,
case = FALSE,
threshold = NULL,
indicate = FALSE,
discard = FALSE,
col.abstract = Abstract) {
if(!is.null(threshold) & !is.numeric(threshold)) {
stop("'threshold' must be an integer >= 0")
}
if(indicate == TRUE & is.null(threshold)) {
threshold <- 1
}
if(discard == TRUE & is.null(threshold)) {
threshold <- 1
}
df_biomarker <- df %>%
dplyr::mutate(Biomarker_score = purrr::map_int({{col.abstract}}, ~ calculate_score(string = .x,
keywords = keywords,
case = case)))
if (indicate == TRUE) {
df_biomarker <- df_biomarker %>%
dplyr::mutate(Biomarker_p = ifelse(Biomarker_score >= threshold, "Yes", "No"))
}
if (discard == TRUE) {
df_biomarker <- df_biomarker %>%
dplyr::filter(Biomarker_score >= threshold)
return(df_biomarker)
} else {
return(df_biomarker)
}
}
plot_score_biomarker <- function(df,
keywords = biomarker_keywords,
case = FALSE,
bins = NULL,
colour = "steelblue3",
col.abstract = Abstract,
col.pmid = PMID,
title = NULL) {
if(is.null(title)) {
title <- "Biomarker score distribution"
}
df_biomarker <- df %>%
dplyr::mutate(Biomarker_score = purrr::map_int({{col.abstract}}, ~ calculate_score(string = .x,
keywords = keywords,
case = case)))
if (is.null(bins)) {
bins <- max(df_biomarker$Biomarker_score) - min(df_biomarker$Biomarker_score)
}
df_biomarker <- df_biomarker %>%
dplyr::select({{col.pmid}}, Biomarker_score) %>%
dplyr::distinct()
plot <- ggplot(df_biomarker, aes(x = Biomarker_score)) +
geom_histogram(bins = bins,
fill = colour,
center = 0,
binwidth = 1) +
theme_classic() +
xlab("Biomarker score") +
ylab("
ggtitle(title) +
scale_x_continuous(expand = c(0,0)) +
scale_y_continuous(expand = c(0,0))
return(plot)
} |
"Temp" |
set.seed(97310)
library("entropart")
data("Paracou618")
N18 <- Paracou618.MC$Nsi[, "P018"]
Abd18 <- as.AbdVector(N18)
autoplot(Abd18, Distribution="lnorm")
P18 <- as.ProbaVector(N18)
rc <- rCommunity(1, size=10000, Distribution = "lseries", alpha = 30)
autoplot(rc, Distribution="lseries")
Richness(P18)
Shannon(P18)
Simpson(P18)
Richness(Abd18)
Shannon(Abd18)
Simpson(Abd18)
Tsallis(Abd18, q=1)
Diversity(Abd18, q=1)
(d2 <- Diversity(Abd18,q=2))
lnq(d2, q=2)
(e2 <-Tsallis(Abd18,q=2))
expq(e2, q=2)
DP <- CommunityProfile(Diversity, Abd18)
autoplot(DP)
summary(PhyloDiversity(Abd18,q=1,Tree=Paracou618.Taxonomy))
DistanceMatrix <- as.matrix(Paracou618.dist)
Z <- 1 - DistanceMatrix/max(DistanceMatrix)
Dqz(Abd18, q=2, Z)
sbDP <- CommunityProfile(Dqz, Abd18, Z=Z)
pDP <- CommunityProfile(function(X, ...) PhyloDiversity(X, ...)$Total, Abd18, Tree=Paracou618.Taxonomy)
autoplot(pDP)
library("entropart")
(df <- data.frame(C1 = c(10, 10, 10, 10), C2 = c(0, 20, 35, 5), C3 = c(25, 15, 0, 2), row.names = c("sp1", "sp2", "sp3", "sp4")))
w <- c(1, 2, 1)
MC <- MetaCommunity(Abundances = df, Weights = w)
plot(MC)
p <- DivPart(q = 1, MC = Paracou618.MC)
summary(p)
de <- DivEst(q = 1, Paracou618.MC, Simulations = 50)
par(mar=c(1,1,2.2,1))
plot(de)
dp <- DivProfile(, Paracou618.MC)
autoplot(dp) |
NULL
.cloudfront$create_cache_policy_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CachePolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), DefaultTTL = structure(logical(0), tags = list(type = "long")), MaxTTL = structure(logical(0), tags = list(type = "long")), MinTTL = structure(logical(0), tags = list(type = "long")), ParametersInCacheKeyAndForwardedToOrigin = structure(list(EnableAcceptEncodingGzip = structure(logical(0), tags = list(type = "boolean")), EnableAcceptEncodingBrotli = structure(logical(0), tags = list(type = "boolean")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "CachePolicyConfig", type = "structure"))), tags = list(type = "structure", payload = "CachePolicyConfig"))
return(populate(args, shape))
}
.cloudfront$create_cache_policy_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CachePolicy = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), CachePolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), DefaultTTL = structure(logical(0), tags = list(type = "long")), MaxTTL = structure(logical(0), tags = list(type = "long")), MinTTL = structure(logical(0), tags = list(type = "long")), ParametersInCacheKeyAndForwardedToOrigin = structure(list(EnableAcceptEncodingGzip = structure(logical(0), tags = list(type = "boolean")), EnableAcceptEncodingBrotli = structure(logical(0), tags = list(type = "boolean")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "CachePolicy"))
return(populate(args, shape))
}
.cloudfront$create_cloud_front_origin_access_identity_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CloudFrontOriginAccessIdentityConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "CloudFrontOriginAccessIdentityConfig", type = "structure"))), tags = list(type = "structure", payload = "CloudFrontOriginAccessIdentityConfig"))
return(populate(args, shape))
}
.cloudfront$create_cloud_front_origin_access_identity_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CloudFrontOriginAccessIdentity = structure(list(Id = structure(logical(0), tags = list(type = "string")), S3CanonicalUserId = structure(logical(0), tags = list(type = "string")), CloudFrontOriginAccessIdentityConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "CloudFrontOriginAccessIdentity"))
return(populate(args, shape))
}
.cloudfront$create_distribution_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), DefaultRootObject = structure(logical(0), tags = list(type = "string")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string", sensitive = TRUE)), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), IncludeCookies = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "DistributionConfig", type = "structure"))), tags = list(type = "structure", payload = "DistributionConfig"))
return(populate(args, shape))
}
.cloudfront$create_distribution_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Distribution = structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), InProgressInvalidationBatches = structure(logical(0), tags = list(type = "integer")), DomainName = structure(logical(0), tags = list(type = "string")), ActiveTrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(AwsAccountNumber = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "Signer", type = "structure"))), tags = list(locationNameList = "Signer", type = "list"))), tags = list(type = "structure")), ActiveTrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(KeyGroupId = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "KeyGroup", type = "structure"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), DistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), DefaultRootObject = structure(logical(0), tags = list(type = "string")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string", sensitive = TRUE)), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), IncludeCookies = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure")), AliasICPRecordals = structure(list(structure(list(CNAME = structure(logical(0), tags = list(type = "string")), ICPRecordalStatus = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "AliasICPRecordal", type = "structure"))), tags = list(locationNameList = "AliasICPRecordal", type = "list"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "Distribution"))
return(populate(args, shape))
}
.cloudfront$create_distribution_with_tags_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionConfigWithTags = structure(list(DistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), DefaultRootObject = structure(logical(0), tags = list(type = "string")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string", sensitive = TRUE)), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), IncludeCookies = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure")), Tags = structure(list(Items = structure(list(structure(list(Key = structure(logical(0), tags = list(type = "string")), Value = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "Tag", type = "structure"))), tags = list(locationNameList = "Tag", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "DistributionConfigWithTags", type = "structure"))), tags = list(type = "structure", payload = "DistributionConfigWithTags"))
return(populate(args, shape))
}
.cloudfront$create_distribution_with_tags_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Distribution = structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), InProgressInvalidationBatches = structure(logical(0), tags = list(type = "integer")), DomainName = structure(logical(0), tags = list(type = "string")), ActiveTrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(AwsAccountNumber = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "Signer", type = "structure"))), tags = list(locationNameList = "Signer", type = "list"))), tags = list(type = "structure")), ActiveTrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(KeyGroupId = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "KeyGroup", type = "structure"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), DistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), DefaultRootObject = structure(logical(0), tags = list(type = "string")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string", sensitive = TRUE)), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), IncludeCookies = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure")), AliasICPRecordals = structure(list(structure(list(CNAME = structure(logical(0), tags = list(type = "string")), ICPRecordalStatus = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "AliasICPRecordal", type = "structure"))), tags = list(locationNameList = "AliasICPRecordal", type = "list"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "Distribution"))
return(populate(args, shape))
}
.cloudfront$create_field_level_encryption_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), QueryArgProfileConfig = structure(list(ForwardWhenQueryArgProfileIsUnknown = structure(logical(0), tags = list(type = "boolean")), QueryArgProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(QueryArg = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "QueryArgProfile", type = "structure"))), tags = list(locationNameList = "QueryArgProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), ContentTypeProfileConfig = structure(list(ForwardWhenContentTypeIsUnknown = structure(logical(0), tags = list(type = "boolean")), ContentTypeProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Format = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string")), ContentType = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "ContentTypeProfile", type = "structure"))), tags = list(locationNameList = "ContentTypeProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "FieldLevelEncryptionConfig", type = "structure"))), tags = list(type = "structure", payload = "FieldLevelEncryptionConfig"))
return(populate(args, shape))
}
.cloudfront$create_field_level_encryption_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryption = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), FieldLevelEncryptionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), QueryArgProfileConfig = structure(list(ForwardWhenQueryArgProfileIsUnknown = structure(logical(0), tags = list(type = "boolean")), QueryArgProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(QueryArg = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "QueryArgProfile", type = "structure"))), tags = list(locationNameList = "QueryArgProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), ContentTypeProfileConfig = structure(list(ForwardWhenContentTypeIsUnknown = structure(logical(0), tags = list(type = "boolean")), ContentTypeProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Format = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string")), ContentType = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "ContentTypeProfile", type = "structure"))), tags = list(locationNameList = "ContentTypeProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryption"))
return(populate(args, shape))
}
.cloudfront$create_field_level_encryption_profile_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionProfileConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), EncryptionEntities = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PublicKeyId = structure(logical(0), tags = list(type = "string")), ProviderId = structure(logical(0), tags = list(type = "string")), FieldPatterns = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "FieldPattern", type = "string"))), tags = list(locationNameList = "FieldPattern", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "EncryptionEntity", type = "structure"))), tags = list(locationNameList = "EncryptionEntity", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "FieldLevelEncryptionProfileConfig", type = "structure"))), tags = list(type = "structure", payload = "FieldLevelEncryptionProfileConfig"))
return(populate(args, shape))
}
.cloudfront$create_field_level_encryption_profile_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionProfile = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), FieldLevelEncryptionProfileConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), EncryptionEntities = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PublicKeyId = structure(logical(0), tags = list(type = "string")), ProviderId = structure(logical(0), tags = list(type = "string")), FieldPatterns = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "FieldPattern", type = "string"))), tags = list(locationNameList = "FieldPattern", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "EncryptionEntity", type = "structure"))), tags = list(locationNameList = "EncryptionEntity", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryptionProfile"))
return(populate(args, shape))
}
.cloudfront$create_invalidation_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionId = structure(logical(0), tags = list(location = "uri", locationName = "DistributionId", type = "string")), InvalidationBatch = structure(list(Paths = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Path", type = "string"))), tags = list(locationNameList = "Path", type = "list"))), tags = list(type = "structure")), CallerReference = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "InvalidationBatch", type = "structure"))), tags = list(type = "structure", payload = "InvalidationBatch"))
return(populate(args, shape))
}
.cloudfront$create_invalidation_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), Invalidation = structure(list(Id = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), CreateTime = structure(logical(0), tags = list(type = "timestamp")), InvalidationBatch = structure(list(Paths = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Path", type = "string"))), tags = list(locationNameList = "Path", type = "list"))), tags = list(type = "structure")), CallerReference = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "Invalidation"))
return(populate(args, shape))
}
.cloudfront$create_key_group_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(KeyGroupConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), Items = structure(list(structure(logical(0), tags = list(locationName = "PublicKey", type = "string"))), tags = list(locationNameList = "PublicKey", type = "list")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "KeyGroupConfig", type = "structure"))), tags = list(type = "structure", payload = "KeyGroupConfig"))
return(populate(args, shape))
}
.cloudfront$create_key_group_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(KeyGroup = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), KeyGroupConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), Items = structure(list(structure(logical(0), tags = list(locationName = "PublicKey", type = "string"))), tags = list(locationNameList = "PublicKey", type = "list")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "KeyGroup"))
return(populate(args, shape))
}
.cloudfront$create_monitoring_subscription_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionId = structure(logical(0), tags = list(location = "uri", locationName = "DistributionId", type = "string")), MonitoringSubscription = structure(list(RealtimeMetricsSubscriptionConfig = structure(list(RealtimeMetricsSubscriptionStatus = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "MonitoringSubscription", type = "structure"))), tags = list(type = "structure", payload = "MonitoringSubscription"))
return(populate(args, shape))
}
.cloudfront$create_monitoring_subscription_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(MonitoringSubscription = structure(list(RealtimeMetricsSubscriptionConfig = structure(list(RealtimeMetricsSubscriptionStatus = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "MonitoringSubscription"))
return(populate(args, shape))
}
.cloudfront$create_origin_request_policy_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(OriginRequestPolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "OriginRequestPolicyConfig", type = "structure"))), tags = list(type = "structure", payload = "OriginRequestPolicyConfig"))
return(populate(args, shape))
}
.cloudfront$create_origin_request_policy_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(OriginRequestPolicy = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), OriginRequestPolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "OriginRequestPolicy"))
return(populate(args, shape))
}
.cloudfront$create_public_key_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(PublicKeyConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), EncodedKey = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "PublicKeyConfig", type = "structure"))), tags = list(type = "structure", payload = "PublicKeyConfig"))
return(populate(args, shape))
}
.cloudfront$create_public_key_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(PublicKey = structure(list(Id = structure(logical(0), tags = list(type = "string")), CreatedTime = structure(logical(0), tags = list(type = "timestamp")), PublicKeyConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), EncodedKey = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "PublicKey"))
return(populate(args, shape))
}
.cloudfront$create_realtime_log_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(EndPoints = structure(list(structure(list(StreamType = structure(logical(0), tags = list(type = "string")), KinesisStreamConfig = structure(list(RoleARN = structure(logical(0), tags = list(type = "string")), StreamARN = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "list")), Fields = structure(list(structure(logical(0), tags = list(locationName = "Field", type = "string"))), tags = list(locationNameList = "Field", type = "list")), Name = structure(logical(0), tags = list(type = "string")), SamplingRate = structure(logical(0), tags = list(type = "long"))), tags = list(type = "structure", locationName = "CreateRealtimeLogConfigRequest", xmlNamespace = "http://cloudfront.amazonaws.com/doc/2020-05-31/"))
return(populate(args, shape))
}
.cloudfront$create_realtime_log_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(RealtimeLogConfig = structure(list(ARN = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), SamplingRate = structure(logical(0), tags = list(type = "long")), EndPoints = structure(list(structure(list(StreamType = structure(logical(0), tags = list(type = "string")), KinesisStreamConfig = structure(list(RoleARN = structure(logical(0), tags = list(type = "string")), StreamARN = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "list")), Fields = structure(list(structure(logical(0), tags = list(locationName = "Field", type = "string"))), tags = list(locationNameList = "Field", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$create_streaming_distribution_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(StreamingDistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), S3Origin = structure(list(DomainName = structure(logical(0), tags = list(type = "string")), OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "StreamingDistributionConfig", type = "structure"))), tags = list(type = "structure", payload = "StreamingDistributionConfig"))
return(populate(args, shape))
}
.cloudfront$create_streaming_distribution_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(StreamingDistribution = structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), DomainName = structure(logical(0), tags = list(type = "string")), ActiveTrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(AwsAccountNumber = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "Signer", type = "structure"))), tags = list(locationNameList = "Signer", type = "list"))), tags = list(type = "structure")), StreamingDistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), S3Origin = structure(list(DomainName = structure(logical(0), tags = list(type = "string")), OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "StreamingDistribution"))
return(populate(args, shape))
}
.cloudfront$create_streaming_distribution_with_tags_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(StreamingDistributionConfigWithTags = structure(list(StreamingDistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), S3Origin = structure(list(DomainName = structure(logical(0), tags = list(type = "string")), OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure")), Tags = structure(list(Items = structure(list(structure(list(Key = structure(logical(0), tags = list(type = "string")), Value = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "Tag", type = "structure"))), tags = list(locationNameList = "Tag", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "StreamingDistributionConfigWithTags", type = "structure"))), tags = list(type = "structure", payload = "StreamingDistributionConfigWithTags"))
return(populate(args, shape))
}
.cloudfront$create_streaming_distribution_with_tags_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(StreamingDistribution = structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), DomainName = structure(logical(0), tags = list(type = "string")), ActiveTrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(AwsAccountNumber = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "Signer", type = "structure"))), tags = list(locationNameList = "Signer", type = "list"))), tags = list(type = "structure")), StreamingDistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), S3Origin = structure(list(DomainName = structure(logical(0), tags = list(type = "string")), OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure"))), tags = list(type = "structure")), Location = structure(logical(0), tags = list(location = "header", locationName = "Location", type = "string")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "StreamingDistribution"))
return(populate(args, shape))
}
.cloudfront$delete_cache_policy_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_cache_policy_output <- function(...) {
list()
}
.cloudfront$delete_cloud_front_origin_access_identity_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_cloud_front_origin_access_identity_output <- function(...) {
list()
}
.cloudfront$delete_distribution_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_distribution_output <- function(...) {
list()
}
.cloudfront$delete_field_level_encryption_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_field_level_encryption_config_output <- function(...) {
list()
}
.cloudfront$delete_field_level_encryption_profile_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_field_level_encryption_profile_output <- function(...) {
list()
}
.cloudfront$delete_key_group_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_key_group_output <- function(...) {
list()
}
.cloudfront$delete_monitoring_subscription_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionId = structure(logical(0), tags = list(location = "uri", locationName = "DistributionId", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_monitoring_subscription_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_origin_request_policy_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_origin_request_policy_output <- function(...) {
list()
}
.cloudfront$delete_public_key_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_public_key_output <- function(...) {
list()
}
.cloudfront$delete_realtime_log_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Name = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure", locationName = "DeleteRealtimeLogConfigRequest", xmlNamespace = "http://cloudfront.amazonaws.com/doc/2020-05-31/"))
return(populate(args, shape))
}
.cloudfront$delete_realtime_log_config_output <- function(...) {
list()
}
.cloudfront$delete_streaming_distribution_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$delete_streaming_distribution_output <- function(...) {
list()
}
.cloudfront$get_cache_policy_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_cache_policy_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CachePolicy = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), CachePolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), DefaultTTL = structure(logical(0), tags = list(type = "long")), MaxTTL = structure(logical(0), tags = list(type = "long")), MinTTL = structure(logical(0), tags = list(type = "long")), ParametersInCacheKeyAndForwardedToOrigin = structure(list(EnableAcceptEncodingGzip = structure(logical(0), tags = list(type = "boolean")), EnableAcceptEncodingBrotli = structure(logical(0), tags = list(type = "boolean")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "CachePolicy"))
return(populate(args, shape))
}
.cloudfront$get_cache_policy_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_cache_policy_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CachePolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), DefaultTTL = structure(logical(0), tags = list(type = "long")), MaxTTL = structure(logical(0), tags = list(type = "long")), MinTTL = structure(logical(0), tags = list(type = "long")), ParametersInCacheKeyAndForwardedToOrigin = structure(list(EnableAcceptEncodingGzip = structure(logical(0), tags = list(type = "boolean")), EnableAcceptEncodingBrotli = structure(logical(0), tags = list(type = "boolean")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "CachePolicyConfig"))
return(populate(args, shape))
}
.cloudfront$get_cloud_front_origin_access_identity_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_cloud_front_origin_access_identity_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CloudFrontOriginAccessIdentity = structure(list(Id = structure(logical(0), tags = list(type = "string")), S3CanonicalUserId = structure(logical(0), tags = list(type = "string")), CloudFrontOriginAccessIdentityConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "CloudFrontOriginAccessIdentity"))
return(populate(args, shape))
}
.cloudfront$get_cloud_front_origin_access_identity_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_cloud_front_origin_access_identity_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CloudFrontOriginAccessIdentityConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "CloudFrontOriginAccessIdentityConfig"))
return(populate(args, shape))
}
.cloudfront$get_distribution_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_distribution_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Distribution = structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), InProgressInvalidationBatches = structure(logical(0), tags = list(type = "integer")), DomainName = structure(logical(0), tags = list(type = "string")), ActiveTrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(AwsAccountNumber = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "Signer", type = "structure"))), tags = list(locationNameList = "Signer", type = "list"))), tags = list(type = "structure")), ActiveTrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(KeyGroupId = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "KeyGroup", type = "structure"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), DistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), DefaultRootObject = structure(logical(0), tags = list(type = "string")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string", sensitive = TRUE)), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), IncludeCookies = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure")), AliasICPRecordals = structure(list(structure(list(CNAME = structure(logical(0), tags = list(type = "string")), ICPRecordalStatus = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "AliasICPRecordal", type = "structure"))), tags = list(locationNameList = "AliasICPRecordal", type = "list"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "Distribution"))
return(populate(args, shape))
}
.cloudfront$get_distribution_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_distribution_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), DefaultRootObject = structure(logical(0), tags = list(type = "string")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string", sensitive = TRUE)), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), IncludeCookies = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "DistributionConfig"))
return(populate(args, shape))
}
.cloudfront$get_field_level_encryption_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_field_level_encryption_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryption = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), FieldLevelEncryptionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), QueryArgProfileConfig = structure(list(ForwardWhenQueryArgProfileIsUnknown = structure(logical(0), tags = list(type = "boolean")), QueryArgProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(QueryArg = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "QueryArgProfile", type = "structure"))), tags = list(locationNameList = "QueryArgProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), ContentTypeProfileConfig = structure(list(ForwardWhenContentTypeIsUnknown = structure(logical(0), tags = list(type = "boolean")), ContentTypeProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Format = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string")), ContentType = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "ContentTypeProfile", type = "structure"))), tags = list(locationNameList = "ContentTypeProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryption"))
return(populate(args, shape))
}
.cloudfront$get_field_level_encryption_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_field_level_encryption_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), QueryArgProfileConfig = structure(list(ForwardWhenQueryArgProfileIsUnknown = structure(logical(0), tags = list(type = "boolean")), QueryArgProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(QueryArg = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "QueryArgProfile", type = "structure"))), tags = list(locationNameList = "QueryArgProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), ContentTypeProfileConfig = structure(list(ForwardWhenContentTypeIsUnknown = structure(logical(0), tags = list(type = "boolean")), ContentTypeProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Format = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string")), ContentType = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "ContentTypeProfile", type = "structure"))), tags = list(locationNameList = "ContentTypeProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryptionConfig"))
return(populate(args, shape))
}
.cloudfront$get_field_level_encryption_profile_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_field_level_encryption_profile_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionProfile = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), FieldLevelEncryptionProfileConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), EncryptionEntities = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PublicKeyId = structure(logical(0), tags = list(type = "string")), ProviderId = structure(logical(0), tags = list(type = "string")), FieldPatterns = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "FieldPattern", type = "string"))), tags = list(locationNameList = "FieldPattern", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "EncryptionEntity", type = "structure"))), tags = list(locationNameList = "EncryptionEntity", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryptionProfile"))
return(populate(args, shape))
}
.cloudfront$get_field_level_encryption_profile_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_field_level_encryption_profile_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionProfileConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), EncryptionEntities = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PublicKeyId = structure(logical(0), tags = list(type = "string")), ProviderId = structure(logical(0), tags = list(type = "string")), FieldPatterns = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "FieldPattern", type = "string"))), tags = list(locationNameList = "FieldPattern", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "EncryptionEntity", type = "structure"))), tags = list(locationNameList = "EncryptionEntity", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryptionProfileConfig"))
return(populate(args, shape))
}
.cloudfront$get_invalidation_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionId = structure(logical(0), tags = list(location = "uri", locationName = "DistributionId", type = "string")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_invalidation_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Invalidation = structure(list(Id = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), CreateTime = structure(logical(0), tags = list(type = "timestamp")), InvalidationBatch = structure(list(Paths = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Path", type = "string"))), tags = list(locationNameList = "Path", type = "list"))), tags = list(type = "structure")), CallerReference = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "Invalidation"))
return(populate(args, shape))
}
.cloudfront$get_key_group_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_key_group_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(KeyGroup = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), KeyGroupConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), Items = structure(list(structure(logical(0), tags = list(locationName = "PublicKey", type = "string"))), tags = list(locationNameList = "PublicKey", type = "list")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "KeyGroup"))
return(populate(args, shape))
}
.cloudfront$get_key_group_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_key_group_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(KeyGroupConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), Items = structure(list(structure(logical(0), tags = list(locationName = "PublicKey", type = "string"))), tags = list(locationNameList = "PublicKey", type = "list")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "KeyGroupConfig"))
return(populate(args, shape))
}
.cloudfront$get_monitoring_subscription_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionId = structure(logical(0), tags = list(location = "uri", locationName = "DistributionId", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_monitoring_subscription_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(MonitoringSubscription = structure(list(RealtimeMetricsSubscriptionConfig = structure(list(RealtimeMetricsSubscriptionStatus = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "MonitoringSubscription"))
return(populate(args, shape))
}
.cloudfront$get_origin_request_policy_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_origin_request_policy_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(OriginRequestPolicy = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), OriginRequestPolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "OriginRequestPolicy"))
return(populate(args, shape))
}
.cloudfront$get_origin_request_policy_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_origin_request_policy_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(OriginRequestPolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "OriginRequestPolicyConfig"))
return(populate(args, shape))
}
.cloudfront$get_public_key_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_public_key_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(PublicKey = structure(list(Id = structure(logical(0), tags = list(type = "string")), CreatedTime = structure(logical(0), tags = list(type = "timestamp")), PublicKeyConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), EncodedKey = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "PublicKey"))
return(populate(args, shape))
}
.cloudfront$get_public_key_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_public_key_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(PublicKeyConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), EncodedKey = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "PublicKeyConfig"))
return(populate(args, shape))
}
.cloudfront$get_realtime_log_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Name = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure", locationName = "GetRealtimeLogConfigRequest", xmlNamespace = "http://cloudfront.amazonaws.com/doc/2020-05-31/"))
return(populate(args, shape))
}
.cloudfront$get_realtime_log_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(RealtimeLogConfig = structure(list(ARN = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), SamplingRate = structure(logical(0), tags = list(type = "long")), EndPoints = structure(list(structure(list(StreamType = structure(logical(0), tags = list(type = "string")), KinesisStreamConfig = structure(list(RoleARN = structure(logical(0), tags = list(type = "string")), StreamARN = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "list")), Fields = structure(list(structure(logical(0), tags = list(locationName = "Field", type = "string"))), tags = list(locationNameList = "Field", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_streaming_distribution_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_streaming_distribution_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(StreamingDistribution = structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), DomainName = structure(logical(0), tags = list(type = "string")), ActiveTrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(AwsAccountNumber = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "Signer", type = "structure"))), tags = list(locationNameList = "Signer", type = "list"))), tags = list(type = "structure")), StreamingDistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), S3Origin = structure(list(DomainName = structure(logical(0), tags = list(type = "string")), OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "StreamingDistribution"))
return(populate(args, shape))
}
.cloudfront$get_streaming_distribution_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$get_streaming_distribution_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(StreamingDistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), S3Origin = structure(list(DomainName = structure(logical(0), tags = list(type = "string")), OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "StreamingDistributionConfig"))
return(populate(args, shape))
}
.cloudfront$list_cache_policies_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Type = structure(logical(0), tags = list(location = "querystring", locationName = "Type", type = "string")), Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_cache_policies_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CachePolicyList = structure(list(NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Type = structure(logical(0), tags = list(type = "string")), CachePolicy = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), CachePolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), DefaultTTL = structure(logical(0), tags = list(type = "long")), MaxTTL = structure(logical(0), tags = list(type = "long")), MinTTL = structure(logical(0), tags = list(type = "long")), ParametersInCacheKeyAndForwardedToOrigin = structure(list(EnableAcceptEncodingGzip = structure(logical(0), tags = list(type = "boolean")), EnableAcceptEncodingBrotli = structure(logical(0), tags = list(type = "boolean")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "CachePolicySummary", type = "structure"))), tags = list(locationNameList = "CachePolicySummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "CachePolicyList"))
return(populate(args, shape))
}
.cloudfront$list_cloud_front_origin_access_identities_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_cloud_front_origin_access_identities_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CloudFrontOriginAccessIdentityList = structure(list(Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), S3CanonicalUserId = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "CloudFrontOriginAccessIdentitySummary", type = "structure"))), tags = list(locationNameList = "CloudFrontOriginAccessIdentitySummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "CloudFrontOriginAccessIdentityList"))
return(populate(args, shape))
}
.cloudfront$list_distributions_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_distributions_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionList = structure(list(Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), DomainName = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean")), AliasICPRecordals = structure(list(structure(list(CNAME = structure(logical(0), tags = list(type = "string")), ICPRecordalStatus = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "AliasICPRecordal", type = "structure"))), tags = list(locationNameList = "AliasICPRecordal", type = "list"))), tags = list(locationName = "DistributionSummary", type = "structure"))), tags = list(locationNameList = "DistributionSummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "DistributionList"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_cache_policy_id_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string")), CachePolicyId = structure(logical(0), tags = list(location = "uri", locationName = "CachePolicyId", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_cache_policy_id_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionIdList = structure(list(Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "DistributionId", type = "string"))), tags = list(locationNameList = "DistributionId", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "DistributionIdList"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_key_group_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string")), KeyGroupId = structure(logical(0), tags = list(location = "uri", locationName = "KeyGroupId", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_key_group_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionIdList = structure(list(Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "DistributionId", type = "string"))), tags = list(locationNameList = "DistributionId", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "DistributionIdList"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_origin_request_policy_id_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(location = "uri", locationName = "OriginRequestPolicyId", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_origin_request_policy_id_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionIdList = structure(list(Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "DistributionId", type = "string"))), tags = list(locationNameList = "DistributionId", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "DistributionIdList"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_realtime_log_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigName = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure", locationName = "ListDistributionsByRealtimeLogConfigRequest", xmlNamespace = "http://cloudfront.amazonaws.com/doc/2020-05-31/"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_realtime_log_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionList = structure(list(Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), DomainName = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean")), AliasICPRecordals = structure(list(structure(list(CNAME = structure(logical(0), tags = list(type = "string")), ICPRecordalStatus = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "AliasICPRecordal", type = "structure"))), tags = list(locationNameList = "AliasICPRecordal", type = "list"))), tags = list(locationName = "DistributionSummary", type = "structure"))), tags = list(locationNameList = "DistributionSummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "DistributionList"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_web_acl_id_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string")), WebACLId = structure(logical(0), tags = list(location = "uri", locationName = "WebACLId", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_distributions_by_web_acl_id_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionList = structure(list(Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), DomainName = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean")), AliasICPRecordals = structure(list(structure(list(CNAME = structure(logical(0), tags = list(type = "string")), ICPRecordalStatus = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "AliasICPRecordal", type = "structure"))), tags = list(locationNameList = "AliasICPRecordal", type = "list"))), tags = list(locationName = "DistributionSummary", type = "structure"))), tags = list(locationNameList = "DistributionSummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "DistributionList"))
return(populate(args, shape))
}
.cloudfront$list_field_level_encryption_configs_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_field_level_encryption_configs_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionList = structure(list(NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), Comment = structure(logical(0), tags = list(type = "string")), QueryArgProfileConfig = structure(list(ForwardWhenQueryArgProfileIsUnknown = structure(logical(0), tags = list(type = "boolean")), QueryArgProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(QueryArg = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "QueryArgProfile", type = "structure"))), tags = list(locationNameList = "QueryArgProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), ContentTypeProfileConfig = structure(list(ForwardWhenContentTypeIsUnknown = structure(logical(0), tags = list(type = "boolean")), ContentTypeProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Format = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string")), ContentType = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "ContentTypeProfile", type = "structure"))), tags = list(locationNameList = "ContentTypeProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "FieldLevelEncryptionSummary", type = "structure"))), tags = list(locationNameList = "FieldLevelEncryptionSummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "FieldLevelEncryptionList"))
return(populate(args, shape))
}
.cloudfront$list_field_level_encryption_profiles_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_field_level_encryption_profiles_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionProfileList = structure(list(NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), Name = structure(logical(0), tags = list(type = "string")), EncryptionEntities = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PublicKeyId = structure(logical(0), tags = list(type = "string")), ProviderId = structure(logical(0), tags = list(type = "string")), FieldPatterns = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "FieldPattern", type = "string"))), tags = list(locationNameList = "FieldPattern", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "EncryptionEntity", type = "structure"))), tags = list(locationNameList = "EncryptionEntity", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "FieldLevelEncryptionProfileSummary", type = "structure"))), tags = list(locationNameList = "FieldLevelEncryptionProfileSummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "FieldLevelEncryptionProfileList"))
return(populate(args, shape))
}
.cloudfront$list_invalidations_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionId = structure(logical(0), tags = list(location = "uri", locationName = "DistributionId", type = "string")), Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_invalidations_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(InvalidationList = structure(list(Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), CreateTime = structure(logical(0), tags = list(type = "timestamp")), Status = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "InvalidationSummary", type = "structure"))), tags = list(locationNameList = "InvalidationSummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "InvalidationList"))
return(populate(args, shape))
}
.cloudfront$list_key_groups_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_key_groups_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(KeyGroupList = structure(list(NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(KeyGroup = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), KeyGroupConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), Items = structure(list(structure(logical(0), tags = list(locationName = "PublicKey", type = "string"))), tags = list(locationNameList = "PublicKey", type = "list")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "KeyGroupSummary", type = "structure"))), tags = list(locationNameList = "KeyGroupSummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "KeyGroupList"))
return(populate(args, shape))
}
.cloudfront$list_origin_request_policies_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Type = structure(logical(0), tags = list(location = "querystring", locationName = "Type", type = "string")), Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_origin_request_policies_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(OriginRequestPolicyList = structure(list(NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Type = structure(logical(0), tags = list(type = "string")), OriginRequestPolicy = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), OriginRequestPolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "OriginRequestPolicySummary", type = "structure"))), tags = list(locationNameList = "OriginRequestPolicySummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "OriginRequestPolicyList"))
return(populate(args, shape))
}
.cloudfront$list_public_keys_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_public_keys_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(PublicKeyList = structure(list(NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), CreatedTime = structure(logical(0), tags = list(type = "timestamp")), EncodedKey = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "PublicKeySummary", type = "structure"))), tags = list(locationNameList = "PublicKeySummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "PublicKeyList"))
return(populate(args, shape))
}
.cloudfront$list_realtime_log_configs_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string")), Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_realtime_log_configs_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(RealtimeLogConfigs = structure(list(MaxItems = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ARN = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), SamplingRate = structure(logical(0), tags = list(type = "long")), EndPoints = structure(list(structure(list(StreamType = structure(logical(0), tags = list(type = "string")), KinesisStreamConfig = structure(list(RoleARN = structure(logical(0), tags = list(type = "string")), StreamARN = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "list")), Fields = structure(list(structure(logical(0), tags = list(locationName = "Field", type = "string"))), tags = list(locationNameList = "Field", type = "list"))), tags = list(type = "structure"))), tags = list(type = "list")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "RealtimeLogConfigs"))
return(populate(args, shape))
}
.cloudfront$list_streaming_distributions_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Marker = structure(logical(0), tags = list(location = "querystring", locationName = "Marker", type = "string")), MaxItems = structure(logical(0), tags = list(location = "querystring", locationName = "MaxItems", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_streaming_distributions_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(StreamingDistributionList = structure(list(Marker = structure(logical(0), tags = list(type = "string")), NextMarker = structure(logical(0), tags = list(type = "string")), MaxItems = structure(logical(0), tags = list(type = "integer")), IsTruncated = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), DomainName = structure(logical(0), tags = list(type = "string")), S3Origin = structure(list(DomainName = structure(logical(0), tags = list(type = "string")), OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "StreamingDistributionSummary", type = "structure"))), tags = list(locationNameList = "StreamingDistributionSummary", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "StreamingDistributionList"))
return(populate(args, shape))
}
.cloudfront$list_tags_for_resource_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Resource = structure(logical(0), tags = list(location = "querystring", locationName = "Resource", type = "string"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$list_tags_for_resource_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Tags = structure(list(Items = structure(list(structure(list(Key = structure(logical(0), tags = list(type = "string")), Value = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "Tag", type = "structure"))), tags = list(locationNameList = "Tag", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure", payload = "Tags"))
return(populate(args, shape))
}
.cloudfront$tag_resource_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Resource = structure(logical(0), tags = list(location = "querystring", locationName = "Resource", type = "string")), Tags = structure(list(Items = structure(list(structure(list(Key = structure(logical(0), tags = list(type = "string")), Value = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "Tag", type = "structure"))), tags = list(locationNameList = "Tag", type = "list"))), tags = list(locationName = "Tags", type = "structure"))), tags = list(type = "structure", payload = "Tags"))
return(populate(args, shape))
}
.cloudfront$tag_resource_output <- function(...) {
list()
}
.cloudfront$untag_resource_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Resource = structure(logical(0), tags = list(location = "querystring", locationName = "Resource", type = "string")), TagKeys = structure(list(Items = structure(list(structure(logical(0), tags = list(locationName = "Key", type = "string"))), tags = list(locationNameList = "Key", type = "list"))), tags = list(locationName = "TagKeys", type = "structure"))), tags = list(type = "structure", payload = "TagKeys"))
return(populate(args, shape))
}
.cloudfront$untag_resource_output <- function(...) {
list()
}
.cloudfront$update_cache_policy_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CachePolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), DefaultTTL = structure(logical(0), tags = list(type = "long")), MaxTTL = structure(logical(0), tags = list(type = "long")), MinTTL = structure(logical(0), tags = list(type = "long")), ParametersInCacheKeyAndForwardedToOrigin = structure(list(EnableAcceptEncodingGzip = structure(logical(0), tags = list(type = "boolean")), EnableAcceptEncodingBrotli = structure(logical(0), tags = list(type = "boolean")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "CachePolicyConfig", type = "structure")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure", payload = "CachePolicyConfig"))
return(populate(args, shape))
}
.cloudfront$update_cache_policy_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CachePolicy = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), CachePolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), DefaultTTL = structure(logical(0), tags = list(type = "long")), MaxTTL = structure(logical(0), tags = list(type = "long")), MinTTL = structure(logical(0), tags = list(type = "long")), ParametersInCacheKeyAndForwardedToOrigin = structure(list(EnableAcceptEncodingGzip = structure(logical(0), tags = list(type = "boolean")), EnableAcceptEncodingBrotli = structure(logical(0), tags = list(type = "boolean")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "CachePolicy"))
return(populate(args, shape))
}
.cloudfront$update_cloud_front_origin_access_identity_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CloudFrontOriginAccessIdentityConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "CloudFrontOriginAccessIdentityConfig", type = "structure")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure", payload = "CloudFrontOriginAccessIdentityConfig"))
return(populate(args, shape))
}
.cloudfront$update_cloud_front_origin_access_identity_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(CloudFrontOriginAccessIdentity = structure(list(Id = structure(logical(0), tags = list(type = "string")), S3CanonicalUserId = structure(logical(0), tags = list(type = "string")), CloudFrontOriginAccessIdentityConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "CloudFrontOriginAccessIdentity"))
return(populate(args, shape))
}
.cloudfront$update_distribution_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(DistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), DefaultRootObject = structure(logical(0), tags = list(type = "string")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string", sensitive = TRUE)), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), IncludeCookies = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "DistributionConfig", type = "structure")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure", payload = "DistributionConfig"))
return(populate(args, shape))
}
.cloudfront$update_distribution_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(Distribution = structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), InProgressInvalidationBatches = structure(logical(0), tags = list(type = "integer")), DomainName = structure(logical(0), tags = list(type = "string")), ActiveTrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(AwsAccountNumber = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "Signer", type = "structure"))), tags = list(locationNameList = "Signer", type = "list"))), tags = list(type = "structure")), ActiveTrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(KeyGroupId = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "KeyGroup", type = "structure"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), DistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), DefaultRootObject = structure(logical(0), tags = list(type = "string")), Origins = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), DomainName = structure(logical(0), tags = list(type = "string")), OriginPath = structure(logical(0), tags = list(type = "string")), CustomHeaders = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(HeaderName = structure(logical(0), tags = list(type = "string")), HeaderValue = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginCustomHeader", type = "structure"))), tags = list(locationNameList = "OriginCustomHeader", type = "list"))), tags = list(type = "structure")), S3OriginConfig = structure(list(OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), CustomOriginConfig = structure(list(HTTPPort = structure(logical(0), tags = list(type = "integer")), HTTPSPort = structure(logical(0), tags = list(type = "integer")), OriginProtocolPolicy = structure(logical(0), tags = list(type = "string")), OriginSslProtocols = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "SslProtocol", type = "string"))), tags = list(locationNameList = "SslProtocol", type = "list"))), tags = list(type = "structure")), OriginReadTimeout = structure(logical(0), tags = list(type = "integer")), OriginKeepaliveTimeout = structure(logical(0), tags = list(type = "integer"))), tags = list(type = "structure")), ConnectionAttempts = structure(logical(0), tags = list(type = "integer")), ConnectionTimeout = structure(logical(0), tags = list(type = "integer")), OriginShield = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), OriginShieldRegion = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(locationName = "Origin", type = "structure"))), tags = list(locationNameList = "Origin", type = "list"))), tags = list(type = "structure")), OriginGroups = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Id = structure(logical(0), tags = list(type = "string")), FailoverCriteria = structure(list(StatusCodes = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "StatusCode", type = "integer"))), tags = list(locationNameList = "StatusCode", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Members = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(OriginId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "OriginGroupMember", type = "structure"))), tags = list(locationNameList = "OriginGroupMember", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "OriginGroup", type = "structure"))), tags = list(locationNameList = "OriginGroup", type = "list"))), tags = list(type = "structure")), DefaultCacheBehavior = structure(list(TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(type = "structure")), CacheBehaviors = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PathPattern = structure(logical(0), tags = list(type = "string")), TargetOriginId = structure(logical(0), tags = list(type = "string")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), TrustedKeyGroups = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyGroup", type = "string"))), tags = list(locationNameList = "KeyGroup", type = "list"))), tags = list(type = "structure")), ViewerProtocolPolicy = structure(logical(0), tags = list(type = "string")), AllowedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list")), CachedMethods = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Method", type = "string"))), tags = list(locationNameList = "Method", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), SmoothStreaming = structure(logical(0), tags = list(type = "boolean")), Compress = structure(logical(0), tags = list(type = "boolean")), LambdaFunctionAssociations = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(LambdaFunctionARN = structure(logical(0), tags = list(type = "string")), EventType = structure(logical(0), tags = list(type = "string")), IncludeBody = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "LambdaFunctionAssociation", type = "structure"))), tags = list(locationNameList = "LambdaFunctionAssociation", type = "list"))), tags = list(type = "structure")), FieldLevelEncryptionId = structure(logical(0), tags = list(type = "string")), RealtimeLogConfigArn = structure(logical(0), tags = list(type = "string")), CachePolicyId = structure(logical(0), tags = list(type = "string")), OriginRequestPolicyId = structure(logical(0), tags = list(type = "string")), ForwardedValues = structure(list(QueryString = structure(logical(0), tags = list(type = "boolean")), Cookies = structure(list(Forward = structure(logical(0), tags = list(type = "string")), WhitelistedNames = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure")), QueryStringCacheKeys = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(deprecated = TRUE, type = "structure")), MinTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), DefaultTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long")), MaxTTL = structure(logical(0), tags = list(deprecated = TRUE, type = "long"))), tags = list(locationName = "CacheBehavior", type = "structure"))), tags = list(locationNameList = "CacheBehavior", type = "list"))), tags = list(type = "structure")), CustomErrorResponses = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(ErrorCode = structure(logical(0), tags = list(type = "integer")), ResponsePagePath = structure(logical(0), tags = list(type = "string")), ResponseCode = structure(logical(0), tags = list(type = "string")), ErrorCachingMinTTL = structure(logical(0), tags = list(type = "long"))), tags = list(locationName = "CustomErrorResponse", type = "structure"))), tags = list(locationNameList = "CustomErrorResponse", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string", sensitive = TRUE)), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), IncludeCookies = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean")), ViewerCertificate = structure(list(CloudFrontDefaultCertificate = structure(logical(0), tags = list(type = "boolean")), IAMCertificateId = structure(logical(0), tags = list(type = "string")), ACMCertificateArn = structure(logical(0), tags = list(type = "string")), SSLSupportMethod = structure(logical(0), tags = list(type = "string")), MinimumProtocolVersion = structure(logical(0), tags = list(type = "string")), Certificate = structure(logical(0), tags = list(deprecated = TRUE, type = "string")), CertificateSource = structure(logical(0), tags = list(deprecated = TRUE, type = "string"))), tags = list(type = "structure")), Restrictions = structure(list(GeoRestriction = structure(list(RestrictionType = structure(logical(0), tags = list(type = "string")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Location", type = "string"))), tags = list(locationNameList = "Location", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), WebACLId = structure(logical(0), tags = list(type = "string")), HttpVersion = structure(logical(0), tags = list(type = "string")), IsIPV6Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure")), AliasICPRecordals = structure(list(structure(list(CNAME = structure(logical(0), tags = list(type = "string")), ICPRecordalStatus = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "AliasICPRecordal", type = "structure"))), tags = list(locationNameList = "AliasICPRecordal", type = "list"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "Distribution"))
return(populate(args, shape))
}
.cloudfront$update_field_level_encryption_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), QueryArgProfileConfig = structure(list(ForwardWhenQueryArgProfileIsUnknown = structure(logical(0), tags = list(type = "boolean")), QueryArgProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(QueryArg = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "QueryArgProfile", type = "structure"))), tags = list(locationNameList = "QueryArgProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), ContentTypeProfileConfig = structure(list(ForwardWhenContentTypeIsUnknown = structure(logical(0), tags = list(type = "boolean")), ContentTypeProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Format = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string")), ContentType = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "ContentTypeProfile", type = "structure"))), tags = list(locationNameList = "ContentTypeProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "FieldLevelEncryptionConfig", type = "structure")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryptionConfig"))
return(populate(args, shape))
}
.cloudfront$update_field_level_encryption_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryption = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), FieldLevelEncryptionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), QueryArgProfileConfig = structure(list(ForwardWhenQueryArgProfileIsUnknown = structure(logical(0), tags = list(type = "boolean")), QueryArgProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(QueryArg = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "QueryArgProfile", type = "structure"))), tags = list(locationNameList = "QueryArgProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), ContentTypeProfileConfig = structure(list(ForwardWhenContentTypeIsUnknown = structure(logical(0), tags = list(type = "boolean")), ContentTypeProfiles = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(Format = structure(logical(0), tags = list(type = "string")), ProfileId = structure(logical(0), tags = list(type = "string")), ContentType = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "ContentTypeProfile", type = "structure"))), tags = list(locationNameList = "ContentTypeProfile", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryption"))
return(populate(args, shape))
}
.cloudfront$update_field_level_encryption_profile_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionProfileConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), EncryptionEntities = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PublicKeyId = structure(logical(0), tags = list(type = "string")), ProviderId = structure(logical(0), tags = list(type = "string")), FieldPatterns = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "FieldPattern", type = "string"))), tags = list(locationNameList = "FieldPattern", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "EncryptionEntity", type = "structure"))), tags = list(locationNameList = "EncryptionEntity", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "FieldLevelEncryptionProfileConfig", type = "structure")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryptionProfileConfig"))
return(populate(args, shape))
}
.cloudfront$update_field_level_encryption_profile_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(FieldLevelEncryptionProfile = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), FieldLevelEncryptionProfileConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), CallerReference = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string")), EncryptionEntities = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(PublicKeyId = structure(logical(0), tags = list(type = "string")), ProviderId = structure(logical(0), tags = list(type = "string")), FieldPatterns = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "FieldPattern", type = "string"))), tags = list(locationNameList = "FieldPattern", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "EncryptionEntity", type = "structure"))), tags = list(locationNameList = "EncryptionEntity", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "FieldLevelEncryptionProfile"))
return(populate(args, shape))
}
.cloudfront$update_key_group_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(KeyGroupConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), Items = structure(list(structure(logical(0), tags = list(locationName = "PublicKey", type = "string"))), tags = list(locationNameList = "PublicKey", type = "list")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "KeyGroupConfig", type = "structure")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure", payload = "KeyGroupConfig"))
return(populate(args, shape))
}
.cloudfront$update_key_group_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(KeyGroup = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), KeyGroupConfig = structure(list(Name = structure(logical(0), tags = list(type = "string")), Items = structure(list(structure(logical(0), tags = list(locationName = "PublicKey", type = "string"))), tags = list(locationNameList = "PublicKey", type = "list")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "KeyGroup"))
return(populate(args, shape))
}
.cloudfront$update_origin_request_policy_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(OriginRequestPolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(locationName = "OriginRequestPolicyConfig", type = "structure")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure", payload = "OriginRequestPolicyConfig"))
return(populate(args, shape))
}
.cloudfront$update_origin_request_policy_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(OriginRequestPolicy = structure(list(Id = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), OriginRequestPolicyConfig = structure(list(Comment = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), HeadersConfig = structure(list(HeaderBehavior = structure(logical(0), tags = list(type = "string")), Headers = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), CookiesConfig = structure(list(CookieBehavior = structure(logical(0), tags = list(type = "string")), Cookies = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure")), QueryStringsConfig = structure(list(QueryStringBehavior = structure(logical(0), tags = list(type = "string")), QueryStrings = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "Name", type = "string"))), tags = list(locationNameList = "Name", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "OriginRequestPolicy"))
return(populate(args, shape))
}
.cloudfront$update_public_key_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(PublicKeyConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), EncodedKey = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(locationName = "PublicKeyConfig", type = "structure")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure", payload = "PublicKeyConfig"))
return(populate(args, shape))
}
.cloudfront$update_public_key_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(PublicKey = structure(list(Id = structure(logical(0), tags = list(type = "string")), CreatedTime = structure(logical(0), tags = list(type = "timestamp")), PublicKeyConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), EncodedKey = structure(logical(0), tags = list(type = "string")), Comment = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "PublicKey"))
return(populate(args, shape))
}
.cloudfront$update_realtime_log_config_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(EndPoints = structure(list(structure(list(StreamType = structure(logical(0), tags = list(type = "string")), KinesisStreamConfig = structure(list(RoleARN = structure(logical(0), tags = list(type = "string")), StreamARN = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "list")), Fields = structure(list(structure(logical(0), tags = list(locationName = "Field", type = "string"))), tags = list(locationNameList = "Field", type = "list")), Name = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), SamplingRate = structure(logical(0), tags = list(type = "long"))), tags = list(type = "structure", locationName = "UpdateRealtimeLogConfigRequest", xmlNamespace = "http://cloudfront.amazonaws.com/doc/2020-05-31/"))
return(populate(args, shape))
}
.cloudfront$update_realtime_log_config_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(RealtimeLogConfig = structure(list(ARN = structure(logical(0), tags = list(type = "string")), Name = structure(logical(0), tags = list(type = "string")), SamplingRate = structure(logical(0), tags = list(type = "long")), EndPoints = structure(list(structure(list(StreamType = structure(logical(0), tags = list(type = "string")), KinesisStreamConfig = structure(list(RoleARN = structure(logical(0), tags = list(type = "string")), StreamARN = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure"))), tags = list(type = "structure"))), tags = list(type = "list")), Fields = structure(list(structure(logical(0), tags = list(locationName = "Field", type = "string"))), tags = list(locationNameList = "Field", type = "list"))), tags = list(type = "structure"))), tags = list(type = "structure"))
return(populate(args, shape))
}
.cloudfront$update_streaming_distribution_input <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(StreamingDistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), S3Origin = structure(list(DomainName = structure(logical(0), tags = list(type = "string")), OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(locationName = "StreamingDistributionConfig", type = "structure")), Id = structure(logical(0), tags = list(location = "uri", locationName = "Id", type = "string")), IfMatch = structure(logical(0), tags = list(location = "header", locationName = "If-Match", type = "string"))), tags = list(type = "structure", payload = "StreamingDistributionConfig"))
return(populate(args, shape))
}
.cloudfront$update_streaming_distribution_output <- function(...) {
args <- c(as.list(environment()), list(...))
shape <- structure(list(StreamingDistribution = structure(list(Id = structure(logical(0), tags = list(type = "string")), ARN = structure(logical(0), tags = list(type = "string")), Status = structure(logical(0), tags = list(type = "string")), LastModifiedTime = structure(logical(0), tags = list(type = "timestamp")), DomainName = structure(logical(0), tags = list(type = "string")), ActiveTrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(list(AwsAccountNumber = structure(logical(0), tags = list(type = "string")), KeyPairIds = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "KeyPairId", type = "string"))), tags = list(locationNameList = "KeyPairId", type = "list"))), tags = list(type = "structure"))), tags = list(locationName = "Signer", type = "structure"))), tags = list(locationNameList = "Signer", type = "list"))), tags = list(type = "structure")), StreamingDistributionConfig = structure(list(CallerReference = structure(logical(0), tags = list(type = "string")), S3Origin = structure(list(DomainName = structure(logical(0), tags = list(type = "string")), OriginAccessIdentity = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), Aliases = structure(list(Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "CNAME", type = "string"))), tags = list(locationNameList = "CNAME", type = "list"))), tags = list(type = "structure")), Comment = structure(logical(0), tags = list(type = "string")), Logging = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Bucket = structure(logical(0), tags = list(type = "string")), Prefix = structure(logical(0), tags = list(type = "string"))), tags = list(type = "structure")), TrustedSigners = structure(list(Enabled = structure(logical(0), tags = list(type = "boolean")), Quantity = structure(logical(0), tags = list(type = "integer")), Items = structure(list(structure(logical(0), tags = list(locationName = "AwsAccountNumber", type = "string"))), tags = list(locationNameList = "AwsAccountNumber", type = "list"))), tags = list(type = "structure")), PriceClass = structure(logical(0), tags = list(type = "string")), Enabled = structure(logical(0), tags = list(type = "boolean"))), tags = list(type = "structure"))), tags = list(type = "structure")), ETag = structure(logical(0), tags = list(location = "header", locationName = "ETag", type = "string"))), tags = list(type = "structure", payload = "StreamingDistribution"))
return(populate(args, shape))
} |
unit_info <- function(unitId, lang = c("pl","en"), ...) {
if (!is.null(unitId) &&nchar_length(unitId) != 12) {
stop("Unit id should be length of 12.")
}
dir <- "units"
lang <- match.arg(lang)
filters <- list(lang = lang)
json <- get_request(dir, id = unitId, filters, ...)
if (is.list(json$results) && length(json$results) == 0) {
stop("Filters returned empty set.")
}
json
} |
saveLog <- function(e)UseMethod("saveLog")
saveLog.default <- function(e){
suppressMessages(suppressWarnings(
saveRDS(e$log, file.path(e$udat, paste0(as.integer(Sys.time()), ".swlog")))))
} |
bvar <- function(data = NULL, exogen = NULL, y, x = NULL,
A0 = NULL, A = NULL, B = NULL,
C = NULL, Sigma = NULL) {
result <- NULL
result[["y"]] <- y
k <- NCOL(y)
tt <- NROW(y)
tvp_a0 <- FALSE
tvp_a <- FALSE
tvp_b <- FALSE
tvp_c <- FALSE
tvp_sigma <- FALSE
structural <- FALSE
if(!is.null(A0)) {
if (is.list(A0)) {
if ("coeffs" %in% names(A0)) {
n_a0 <- nrow(A0[["coeffs"]])
}
} else {
n_a0 <- nrow(A0)
}
if (n_a0 / tt >= 1) {
tvp_a0 <- TRUE
n_a0 <- n_a0 / tt
}
if (n_a0 %% (k * k) != 0) {
stop("Row number of coefficient draws of 'A0' is not k^2 or multiples thereof.")
}
structural <- TRUE
}
if(!is.null(A)) {
if (is.list(A)) {
if ("coeffs" %in% names(A)) {
n_a <- nrow(A[["coeffs"]])
}
} else {
n_a <- nrow(A)
}
if ((n_a / tt) %% k^2 == 0 & n_a / tt >= 1) {
tvp_a <- TRUE
n_a <- n_a / tt
}
}
if(!is.null(B)) {
if (is.null(x) & is.null(exogen)) {
stop("Please specify either argument 'x' or 'exogen' when using exogenous regressors.")
}
if (is.list(B)) {
if ("coeffs" %in% names(B)) {
n_b <- nrow(B[["coeffs"]])
}
} else {
n_b <- nrow(B)
}
if ((n_b / tt) %% k == 0) {
tvp_b <- TRUE
n_b <- n_b / tt
}
}
if(!is.null(C)) {
if (is.list(C)) {
if ("coeffs" %in% names(C)) {
n_c <- NROW(C[["coeffs"]])
}
} else {
n_c <- NROW(C)
}
if ((n_c / tt) %% k == 0 & n_c / tt >= 1) {
tvp_c <- TRUE
n_c <- n_c / tt
}
}
if(!is.null(Sigma)) {
if (is.list(Sigma)) {
if ("coeffs" %in% names(Sigma)) {
n_sigma <- nrow(Sigma[["coeffs"]])
}
} else {
n_sigma <- nrow(Sigma)
}
if ((n_sigma / tt) %% k == 0 & n_sigma / tt >= 1) {
tvp_sigma <- TRUE
n_sigma <- n_sigma / tt
}
if (n_sigma %% (k * k) != 0) {
stop("Row number of coefficient draws of 'Sigma' is not k^2 or multiples thereof.")
}
}
if(!is.null(data)) {
result[["data"]] <- data
}
if(!is.null(exogen)) {
result[["exogen"]] <- exogen
}
if(!is.null(x)) {
result[["x"]] <- x
}
if(!is.null(A0)) {
result <- c(result, .bvar_fill_helper(A0, tvp_a0, n_a0, tt, "A0"))
}
if(!is.null(A)) {
if (n_a %% k == 0) {
p <- n_a / k^2
} else {
stop("Row number of argument 'A' is not a multiple of the number of endogenous variables.")
}
result <- c(result, .bvar_fill_helper(A, tvp_a, n_a, tt, "A"))
} else {
p <- 0
}
m <- 0
s <- 0
if(!is.null(B)) {
result <- c(result, .bvar_fill_helper(B, tvp_b, n_b, tt, "B"))
if (!is.null(exogen)) {
m <- NCOL(exogen)
s <- n_b / (k * m) - 1
}
if (!is.null(x)) {
x_names <- dimnames(x)[[2]][k * p + 1:(n_b / k)]
x_lags <- as.numeric(substring(x_names, unlist(gregexpr(".l", x_names)) + 2, nchar(x_names)))
m <- sum(x_lags == 0)
s <- max(x_lags)
}
}
if(!is.null(C)) {
result <- c(result, .bvar_fill_helper(C, tvp_c, n_c, tt, "C"))
}
if(!is.null(Sigma)) {
result <- c(result, .bvar_fill_helper(Sigma, tvp_sigma, k * k, tt, "Sigma"))
}
result[["specifications"]] <- list("dims" = list("K" = k, "M" = m),
"lags" = list("p" = p, "s" = s),
"tvp" = list("A0" = tvp_a0,
"A" = tvp_a,
"B" = tvp_b,
"C" = tvp_c,
"Sigma" = tvp_sigma),
"structural" = structural)
class(result) <- "bvar"
return(result)
} |
expected <- eval(parse(text="c(0.38268343236509, 0.707106781186547, 0.923879532511287, 1, 0.923879532511287, 0.707106781186548, 0.38268343236509, 1.22464679914735e-16, -0.38268343236509, -0.707106781186547, -0.923879532511287, -1, -0.923879532511287, -0.707106781186548, -0.38268343236509, -2.44929359829471e-16)"));
test(id=0, code={
argv <- eval(parse(text="list(c(0.923879532511287+0.38268343236509i, 0.707106781186548+0.707106781186547i, 0.38268343236509+0.923879532511287i, 0+1i, -0.38268343236509+0.923879532511287i, -0.707106781186547+0.707106781186548i, -0.923879532511287+0.38268343236509i, -1+0i, -0.923879532511287-0.38268343236509i, -0.707106781186548-0.707106781186547i, -0.38268343236509-0.923879532511287i, 0-1i, 0.38268343236509-0.923879532511287i, 0.707106781186547-0.707106781186548i, 0.923879532511287-0.38268343236509i, 1-0i))"));
do.call(`Im`, argv);
}, o=expected); |
Sybil_2_FBA_obj<-function(Sybil_S4_object)
{
FBA_obj=list()
FBA_obj$mat<-Sybil_S4_object@S
FBA_obj$obj<-Sybil_S4_object@obj_coef
FBA_obj$rhs<-Sybil_S4_object@rhs
FBA_obj$types<-rep("C",dim(Sybil_S4_object@S)[2])
FBA_obj$dir<-rep("==",dim(Sybil_S4_object@S)[1])
FBA_obj$bounds<-list(lower=list(ind=1:length(Sybil_S4_object@lowbnd),val=Sybil_S4_object@lowbnd),upper=list(ind=1:length(Sybil_S4_object@uppbnd),val=Sybil_S4_object@uppbnd))
FBA_obj$max<-TRUE
FBA_obj$reaction_list<-Sybil_S4_object@react_name
FBA_obj$metabolite_name<-Sybil_S4_object@met_name
FBA_obj$sub_system<-Sybil_S4_object@subSys
FBA_obj$compartment<-Sybil_S4_object@met_comp
FBA_obj$comp_name<-Sybil_S4_object@mod_compart
FBA_obj$all_genes<-Sybil_S4_object@allGenes
FBA_obj$gpr<-Sybil_S4_object@gpr
FBA_obj$rxnGeneMat<-Sybil_S4_object@rxnGeneMat
return(FBA_obj)
} |
library(expss)
data(mtcars)
mtcars = apply_labels(mtcars,
mpg = "Miles/(US) gallon",
cyl = "Number of cylinders",
disp = "Displacement (cu.in.)",
hp = "Gross horsepower",
drat = "Rear axle ratio",
wt = "Weight (1000 lbs)",
qsec = "1/4 mile time",
vs = "Engine",
vs = c("V-engine" = 0,
"Straight engine" = 1),
am = "Transmission",
am = c("Automatic" = 0,
"Manual"=1),
gear = "Number of forward gears",
carb = "Number of carburetors"
)
nps = c(-1, 0, 1, 1, 0, 1, 1, -1)
var_lab(nps) = "Net promoter score"
val_lab(nps) = num_lab("
-1 Detractors
0 Neutralists
1 Promoters
")
var_lab(nps)
val_lab(nps)
add_val_lab(nps) = num_lab("
98 Other
99 Hard to say
")
val_lab(nps) = val_lab(nps) %d% 98
val_lab(nps) = val_lab(nps) %n_d% "Other"
drop_val_labs(nps)
drop_var_labs(nps)
unlab(nps)
drop_unused_labels(nps)
prepend_values(nps)
with(mtcars, table(am, vs))
with(mtcars,
barplot(
table(am, vs),
beside = TRUE,
legend = TRUE)
)
use_labels(mtcars, table(am, vs))
use_labels(mtcars, lm(mpg ~ wt + hp + qsec)) %>% summary
use_labels(mtcars, boxplot(mpg ~ am))
library(ggplot2, warn.conflicts = FALSE)
use_labels(mtcars, {
ggplot(..data) +
geom_point(aes(y = mpg, x = wt, color = qsec)) +
facet_grid(factor(am) ~ factor(vs))
})
nps = c(-1, 0, 1, 1, 0, 1, 1, -1)
var_lab(nps) = "Net promoter score"
val_lab(nps) = num_lab("
-1 Detractors
0 Neutralists
1 Promoters
99 Hard to say
")
expss_disable_value_labels_support()
table(nps)
unique(nps)
expss_enable_value_labels_support()
table(nps)
unique(nps)
expss_enable_value_labels_support_extreme()
table(nps)
unique(nps)
expss_enable_value_labels_support()
str(mtcars)
mtcars_subset = mtcars[1:10, ]
str(mtcars_subset) |
.A.matrix2 <- function( resp, formulaA=~ item + item*step, facets=NULL,
constraint=c("cases", "items"), progress=FALSE,
maxKi=NULL, Q=Q )
{
z0 <- Sys.time()
facets0 <- facets
NF <- length(facets)
facet.list <- as.list( 1:NF )
names(facet.list) <- colnames(facets)
if (NF==0){ facet.list <- NULL }
if (NF>0){
for (ff in 1:NF){
uff <- sort( unique( facets[,ff] ) )
facets[,ff] <- match( facets[,ff], uff )
facet.list[[ff]] <- data.frame(
"facet.label"=paste0( colnames(facets)[ff], uff ),
"facet.index"=paste0( colnames(facets)[ff], seq(1,length(uff) ) ) )
}
}
constraint <- match.arg(constraint)
if ( is.null(maxKi) ){
maxKi <- apply( resp, 2, max, na.rm=TRUE )
}
maxK <- max( maxKi )
nI <- ncol(resp)
i11 <- names(maxKi)[ maxKi==0 ]
if ( length(i11) > 0 ){
stop( cat( "Items with maximum score of 0:", paste(i11, collapse=" " ) ) )
}
tf <- stats::terms( formulaA )
fvars <- as.vector( attr(tf,"variables"), mode="character" )[-1]
otherFacets <- setdiff( fvars, c("item", "step") )
contr.list <- as.list( rep( "contr.sum", length(fvars) ) )
names( contr.list ) <- fvars
nitems <- ncol(resp)
expand.list <- vector(mode="list", length=0)
if( "item" %in% fvars ) expand.list <- c(expand.list, if("item" %in% names(facet.list)) list(as.factor(sort(unique(facets[,"item"])))) else list(factor(1:nI)) )
if( "step" %in% fvars ) expand.list <- c(expand.list, if("step" %in% names(facet.list)) list(as.factor(sort(unique(facets[,"step"])))) else list(factor(1:maxK)) )
if( length( otherFacets )==1) expand.list <- c(expand.list, list(factor(1:max(facets[, otherFacets]))) )
if( length( otherFacets ) > 1 ) expand.list <- c(expand.list, sapply( otherFacets, FUN=function(ff) as.factor(1:max(facets[, ff])), simplify=FALSE ))
names( expand.list ) <- fvars
for (vv in seq(1, length(expand.list) ) ){
expand.list[[vv]] <- paste( expand.list[[vv]] )
}
g2 <- g1 <- expand.grid(expand.list)
diffK <- ( stats::sd( maxKi) > 0 )
diffK <- TRUE
if (diffK){
I <- length(maxKi)
for (ii in 1:I){
ind <- which( ( ( as.numeric(paste0(g1$item))==ii ) &
( as.numeric(paste0(g1$step)) > maxKi[ii] ) ) )
if ( length(ind) > 0 ){
g1 <- g1[ - ind, ]
}
}
}
X <- rownames.design2( g1 )
if (diffK){
X2 <- rownames.design2( g2 )
}
if( constraint=="cases" ) formulaA <- stats::update.formula(formulaA, ~0+.)
NX <- ncol(X)
for (ff in 1:NX){
uff <- length( unique(X[,ff] ) )
if (uff==1){ cat(paste0(" - facet ",
colnames(X)[ff], " does only have one level!" ), "\n") }
}
mm <- - stats::model.matrix(formulaA, X, contrasts=contr.list)
if (diffK){
mm2 <- - stats::model.matrix(formulaA, X2, contrasts=contr.list)
}
if( constraint=="items" ){ mm <- mm[,-1] }
xsi.constr <- .generate.interactions2(X, facets, formulaA, mm )
if( "step" %in% fvars ){
if( ncol( attr(tf, "factors") )==1 ){
return( warning("Can't proceed the estimation:
Factor of order 1 other than step must be specified.") )
}
if( all( attr(tf, "factors")["step",] !=1 ) ){
return( warning("Can't proceed the estimation:
Lower-order term is missing.") )
}
A <- NULL
stepgroups <- unique( gsub( "(^|-)+step([[:digit:]])*", "\\1step([[:digit:]])*", rownames(X) ) )
X.out <- data.frame(as.matrix(X), stringsAsFactors=FALSE)
if (progress){
cat(" o Create design matrix A\n")
ip <- length(stepgroups)
VP <- min( ip, 10 )
cat(paste0(" |",paste0( rep("*", VP), collapse=""), "|\n"))
cat(" |") ; utils::flush.console()
if (VP<10){ disp_progress <- 1:ip } else {
disp_progress <- 100* ( 1:ip ) / (ip+1)
disp_progress <- sapply( seq(5,95,10), FUN=function(pp){
which.min( abs( disp_progress - pp ) )[1] }
)
}
}
xsi.elim.index <- xsi.elim <- NULL
ii <- 0 ; vv <- 1
for( sg in stepgroups ){
mm1 <- grep(paste0("(", sg, ")+$"), rownames(mm))
ind2 <- grep( paste0("(", sg, ")+$"), rownames(mm))
mm.sg.temp <- rbind( 0, apply( mm[ ind2,,drop=FALSE], 2, cumsum ) )
if ( is.null(rownames(mm.sg.temp)) ){
rownames(mm.sg.temp) <- paste0("rn", seq(0,nrow(mm.sg.temp)-1) )
}
rownames(mm.sg.temp)[1] <- gsub("step([[:digit:]])*", "step0", sg, fixed=T)
rownames(mm.sg.temp)[-1] <- rownames(mm[ind2,,drop=FALSE])
sg1 <- strsplit( sg, split="-")[[1]]
ii <- as.numeric( gsub("item", "", sg1[1] ) )
maxKi_ii <- maxKi[ii]
if (is.na(ii)){
maxKi_ii <- maxK
}
if ( maxKi_ii < maxK ){
for (kk in (maxKi[ii]+1):maxK){
mm.sg.temp[ grep( paste0( "-step", kk ), rownames(mm.sg.temp) ), ] <- NA
i1 <- grep( paste0(sg1[1],"\\:" ), colnames(mm.sg.temp), value=TRUE)
i2 <- grep( paste0(":step", kk-1), colnames(mm.sg.temp), value=TRUE)
i3 <- intersect( i1, i2 )
if ( length(i3) > 0 ){
xsi.elim <- c( xsi.elim, i3 )
xsi.elim.index <- c( xsi.elim.index,
which( colnames(mm.sg.temp ) %in% i3 ) )
mm.sg.temp[, i3 ][ ! ( is.na( mm.sg.temp[, i3 ] ) )] <- 0
}
}
}
A <- rbind(A, mm.sg.temp)
if ( maxKi_ii < maxK ){
for (kk in (maxKi[ii]+1):maxK){
vv <- paste0( sg1[1], "-step", kk )
X.out[ grep( vv, rownames(X.out) ), 2 ] <- 0
}
}
x.sg.temp <- X.out[grep(sg, rownames(X.out))[1], ]
x.sg.temp[,"step"] <- 0
rownames(x.sg.temp) <- gsub("step([[:digit:]])*", "step0", sg, fixed=TRUE)
X.out <- rbind(X.out, x.sg.temp)
progress <- progress & ( ! is.na(ii) )
if ( progress ){
ii <- ii+1
if (( ii==disp_progress[vv] ) & (vv<=10) ){
cat("-") ; utils::flush.console()
vv <- vv+1
}
}
}
if ( progress ){
cat("|\n") ; utils::flush.console()
}
} else {
rownames(mm) <- paste( rownames(X), "-step1", sep="")
A <- mm
for( kk in setdiff(0:maxK, 1) ){
mm.k.temp <- mm*kk
rownames(mm.k.temp) <- paste( rownames(X), "-step", kk, sep="")
A <- rbind(A, mm.k.temp)
}
X.out <- expand.grid( c( expand.list, list("step"=factor(0:maxK)) ) )
X.out <- rownames.design2( data.frame(as.matrix(X.out), stringsAsFactors=FALSE) )
}
A[ rowMeans(is.na(A)) < 1, xsi.elim ] <- 0
facet.design <- list( "facets"=facets, "facets.orig"=facets0,
"facet.list"=facet.list[otherFacets])
A <- A[ ! duplicated( rownames(A) ), ]
A <- A[order(rownames(A)),,drop=FALSE]
X.out <- X.out[order(rownames(X.out)),,drop=FALSE]
if ( ! is.null(xsi.elim) ){
xsi.elim <- data.frame( xsi.elim, xsi.elim.index )
xsi.elim <- xsi.elim[ ! duplicated( xsi.elim[,2] ), ]
xsi.elim <- xsi.elim[ order( xsi.elim[,2] ), ]
}
xsi1 <- xsi.constr$xsi.constraints
xsi.constr$intercept_included <- FALSE
ind <- grep("(Intercept", rownames(xsi1), fixed=TRUE)
if ( length(ind) > 0 ){
xsi1 <- xsi1[ - ind, ]
xsi.constr$xsi.constraints <- xsi1
xsi.constr$intercept_included <- TRUE
}
xsi1 <- xsi.constr$xsi.table
ind <- grep("(Intercept", paste(xsi1$parameter), fixed=TRUE)
if ( length(ind) > 0 ){
xsi1 <- xsi1[ - ind, ]
xsi.constr$xsi.table <- xsi1
}
return(list( "A"=A, "X"=X.out, "otherFacets"=otherFacets, "xsi.constr"=xsi.constr,
"facet.design"=facet.design, "xsi.elim"=xsi.elim ) )
} |
iqLearnFSC <- function(...,
moMain,
moCont,
data,
response,
txName,
iter = 0L,
verbose = TRUE){
if (missing(x = moMain)) moMain <- NULL
if (!is(object = moMain, class2 = "modelObj") &&
!is.null(x = moMain)) {
stop("moMain must be one of {modelObj, NULL}")
}
if (missing(x = moCont)) moCont <- NULL
if (!is(object = moCont, class2 = "modelObj") &&
!is.null(x = moCont)) {
stop("moCont must be one of {modelObj, NULL}")
}
if (is.null(x = moMain) && is.null(x = moCont)) {
stop("must provide moMain and/or moCont")
} else if (is.null(x = moMain) || is.null(x = moCont)) {
iter <- NULL
}
data <- .verifyDataFrame(data = data)
if (!is(object = response, class2 = "IQLearnSS")) {
stop("response must be an object returned by iqLearnSS()")
}
data <- .checkTxData(txName = txName, data = data)
txVec <- .checkBinaryTx(txName = txName, data = data)
if (!isTRUE(x = all.equal(target = txVec, current = data[,txName]))) {
cat("Treatment variable converted to {-1,1}\n")
data[,txName] <- as.integer(x = round(x = txVec))
}
iter <- .verifyIter(iter = iter)
verbose <- .verifyVerbose(verbose = verbose)
result <- .newIQLearnFS_C(moMain = moMain,
moCont = moCont,
data = data,
response = response,
txName = txName,
iter = iter,
suppress = !verbose)
result@analysis@call <- match.call()
return(result)
} |
plausible_scores = function(dataSrc, parms=NULL, predicate=NULL, items=NULL,
covariates=NULL, keep.observed=TRUE, nPS=1,merge_within_persons=FALSE)
{
qtpredicate = eval(substitute(quote(predicate)))
env = caller_env()
check_dataSrc(dataSrc)
plausible_scores_(dataSrc, parms=parms, qtpredicate=qtpredicate, items=items, covariates=covariates,
keep.observed=keep.observed, nPS=nPS, env=env,
merge_within_persons=merge_within_persons) %>%
mutate_if(is.factor, as.character) %>%
df_format()
}
plausible_scores_ = function(dataSrc, parms=NULL, qtpredicate=NULL, items=NULL,
covariates=NULL, keep.observed=TRUE, nPS=1, env=NULL,
merge_within_persons=FALSE)
{
if (is.null(env))
env = caller_env()
from = Gibbs.settings$from.ps
step = Gibbs.settings$step.ps
keep.which = seq(from,(from-step)*(from>step)+step*nPS,by=step)
nPS.needed = max(keep.which)
pb = get_prog_bar(nsteps=if(is.null(parms)) 120 else 100,
retrieve_data = is_db(dataSrc))
on.exit({pb$close()})
if(is.null(parms))
{
pcheck=NULL
} else if(inherits(parms,'data.frame'))
{
parms = transform.df.parms(parms,'b', TRUE)
pcheck = parms[,c('item_id','item_score')]
} else
{
pcheck = parms$inputs$ssIS[,c('item_id','item_score')]
}
respData = get_resp_data(dataSrc, qtpredicate, summarised = FALSE,
extra_columns = covariates, env = env,
parms_check=pcheck,
merge_within_persons=merge_within_persons)
use_b_matrix = FALSE
if(is.null(parms))
{
nIter.enorm = Gibbs.settings$from.pv + Gibbs.settings$step.pv*(nPS.needed-1)
pb$new_area(20)
parms = fit_enorm_(respData, method='Bayes', nDraws = nIter.enorm)
} else if(inherits(parms,'prms') && parms$inputs$method != 'CML')
{
if (nrow(parms$est$b) < nPS.needed)
{
stop(paste("Not enough posterior samples in fit_enorm for",
nPS, "plausible scores. Use at least", nPS.needed, "samples in fit_enorm"))
} else
{
use_b_matrix = TRUE
}
}
pb$new_area(80)
pv = plausible_values_(respData, parms = parms, covariates = covariates, nPV = nPS.needed)
pb$close_area()
if(is.null(items))
{
items = unique(respData$design$item_id)
}
else
{
if(inherits(items, 'data.frame'))
items = items$item_id
items = unique(as.character(items))
}
simple_parms = simplify_parms(parms, collapse_b = !use_b_matrix, design = tibble(item_id=items))
items = select(simple_parms$design, -.data$booklet_id)
a = simple_parms$a
b = simple_parms$b
items$item_id = re_factor_item_id(respData, items$item_id)
levels(respData$x$item_id) = levels(respData$design$item_id) = levels(items$item_id)
design = respData$design
if(length(intersect(respData$design$item_id, items$item_id)) == 0)
{
pv = mutate(pv, booklet_score = 0L)
} else
{
respData = semi_join(respData, items, by='item_id', .recompute_sumscores = TRUE)
respData = get_resp_data(respData, summarised = TRUE, protect_x=FALSE)
pv = pv %>%
select(-.data$booklet_score) %>%
left_join(respData$x, by=c("person_id", "booklet_id")) %>%
mutate(booklet_score = coalesce(.data$booklet_score, 0L))
}
pb$tick()
if(keep.observed)
{
bkList = lapply(split(design, design$booklet_id),
function(bk_items){ items %>% anti_join(bk_items, by='item_id') %>% arrange(.data$first)})
pv = pv %>%
group_by(.data$booklet_id) %>%
do({
bk = as.data.frame(bkList[[.$booklet_id[1]]])
if(NROW(bk)==0)
{
mutate_at(.,vars(starts_with('PV')),`<-`, .$booklet_score )
} else
{
cntr = (function(){i=0L; function(){i<<-i+1L; i}})()
mutate_at(.,vars(starts_with('PV')), rscore, b=b, a=a, first=bk$first, last=bk$last, cntr=cntr, use_b_matrix = use_b_matrix) %>%
mutate_at(vars(starts_with('PV')), `+`, .$booklet_score)
}
}) %>%
ungroup()
} else
{
cnt = (function(){i=0L;function(){i<<-i+1L;i}})()
pv = pv %>%
mutate_at(vars(starts_with('PV')), rscore, b=b, a=a, first=items$first,last=items$last,cntr=cnt, use_b_matrix = use_b_matrix)
}
pv = pv %>%
select(.data$booklet_id,.data$person_id, starts_with('PV'))
pv = pv[, c(1,2,keep.which+2)]
colnames(pv) = c('booklet_id','person_id', paste0('PS',1:nPS))
pv
} |
rm(list=ls())
options(stringsAsFactors = F)
library(stringr)
a=read.table('~/Downloads/MAS5_1809_kerekitett_vegleges.txt',header = T)
a[1:4,1:4]
rownames(a)=a[,1]
a=a[,-1]
a[1:4,1:4]
b=read.table('~/Downloads/expdesc_1809.txt',header = T,fill = T,sep = '\t')[,c(1,3:6)]
head(b)
colnames(b)=c('gsm','rfs_event','rfs_time','os_event','os_time')
cxb6_expr <- data.frame(gsm=colnames(a),v=as.numeric(a['202048_s_at',]))
cxb6_expr$g=ifelse(cxb6_expr$v>median(cxb6_expr$v),'high','low')
head(cxb6_expr)
dat=merge(cxb6_expr,b,by='gsm')
dat$rfs_time=as.numeric(gsub(',','.',dat$rfs_time))
dat$os_time=as.numeric(gsub(',','.',dat$os_time))
head(dat)
library(survival)
library(survminer)
sfit <- survfit(Surv(rfs_time, rfs_event)~g, data=dat)
sfit <- survfit(Surv(os_time, os_event)~g, data=dat)
sfit
summary(sfit)
ggsurvplot(
sfit, risk.table = TRUE, ggtheme = theme_bw(),
pval = TRUE, pval.coord = c(0, 0.03)
)
ggsurvplot(sfit, conf.int=F, pval=TRUE)
ggsurvplot(sfit,palette = c("
risk.table =TRUE,pval =TRUE,
conf.int =TRUE,xlab ="Time in months",
ggtheme =theme_light(),
ncensor.plot = TRUE)
ggsurvplot(
sfit, risk.table = TRUE, ggtheme = theme_bw(),
pval = TRUE, pval.coord = c(0, 0.03)
) |
testretest.multiverse <- function(input,
specifications,
test = "ICC2",
var.participant = "subject",
var.ACC = "correct",
var.RT = "RT") {
subject = var.participant
correct = var.ACC
outlist <- list("input" = input,
"specifications" = specifications,
"test" = test,
"reliability" = "test_retest")
n <- 0
ACC <- 0
latency <- 0
blockcode <- 0
congruency <- 0
low <- 0
high <- 0
RT <- 0
Incongruent <- 0
Congruent <- 0
time <- 0
difference <- 0
ICC <- 0
outlist$cols <- names(specifications)
if(!("ACC_cutoff" %in% names(specifications))){
specifications[["ACC_cutoff"]] <- 0
}
if(!("RT_min" %in% names(specifications))){
specifications[["RT_min"]] <- 0
}
if(!("RT_max" %in% names(specifications))){
specifications[["RT_max"]] <- 1000000
}
if(!("RT_sd_cutoff" %in% names(specifications))){
specifications[["RT_sd_cutoff"]] <- 0
}
if(!("split_by" %in% names(specifications))){
specifications[["split_by"]] <- "subject"
}
if(!("averaging_method" %in% names(specifications))){
specifications[["averaging_method"]] <- "mean"
}
specs <- expand.grid(specifications)
nS <- nrow(specs)
outlist$specs <- specs
outlist$nS <- nS
print(paste("running", nS, "pre-processing specifications"))
temp_data <- input %>%
group_by(time, subject) %>%
mutate(ACC = sum(correct) / n())
perm_out <- list()
pb <- txtProgressBar(min = 0, max = nS, style = 3)
setTxtProgressBar(pb, 0)
for(perm in 1:nS) {
temp <- temp_data %>%
filter(ACC >= specs[perm, "ACC_cutoff"]) %>%
group_by(time, subject) %>%
filter(correct == 1) %>%
filter(latency >= specs[perm, "RT_min"],
latency <= specs[perm, "RT_max"]) %>%
ungroup()
if(specs[perm, "split_by"] == "subject")
temp <- temp %>%
group_by(time, subject)
if(specs[perm, "split_by"] == "condition")
temp <- temp %>%
group_by(time, subject, blockcode)
if(specs[perm, "split_by"] == "trial")
temp <- temp %>%
group_by(time, subject, blockcode, congruency)
if(specs[perm, "RT_sd_cutoff"] != 0)
temp <- temp %>%
mutate(high = mean(latency) + (specs[perm, "RT_sd_cutoff"]*sd(latency)),
low = mean(latency) - (specs[perm, "RT_sd_cutoff"]*sd(latency))) %>%
filter(latency >= low, latency <= high) %>%
ungroup() %>%
as.data.frame()
perm_out[[perm]] <- temp
setTxtProgressBar(pb, perm)
}
outlist$sca <- perm_out
nPar <- 1:nS
nTrial <- 1:nS
for(i in 1:nS) {
nPar[i] <- length(unique(perm_out[[i]]$subject))
nTrial[i] <- length(perm_out[[i]]$trialnum)
}
removals <- specs
removals$nPar <- nPar
removals$nTrial <- nTrial
removals$nTrialperPar <- removals$nTrial / removals$nPar
removals$pPar <- removals$nPar / length(unique(input$subject))
removals$pTrial <- removals$nTrial / length(input$trialnum)
outlist$removals <- removals
print("running reliability estimates")
estimates <- list()
if(test == "ICC2")
icc <- 2
if(test == "ICC3")
icc <- 3
pb2 <- txtProgressBar(min = 0, max = nS, style = 3)
setTxtProgressBar(pb2, 0)
if(test == "ICC2" | test == "ICC3") {
for(perm2 in 1:nS) {
capture.output({
tmp <- perm_out[[perm2]] %>%
group_by(time, subject, congruency) %>%
summarise(RT = mean(latency)) %>%
spread(congruency, RT) %>%
mutate(difference = Incongruent - Congruent) %>%
select(-Congruent, -Incongruent) %>%
group_by(time) %>%
spread(time, difference)
estimates[[perm2]] <- ICC(tmp[,2:3])$results[icc,]
})
setTxtProgressBar(pb2, perm2)
}
}
if(test == "cor")
{
for(perm2 in 1:nS) {
capture.output({
tmp <<- perm_out[[perm2]] %>%
group_by(time, subject, congruency) %>%
summarise(RT = mean(latency)) %>%
spread(congruency, RT) %>%
mutate(difference = Incongruent - Congruent) %>%
select(-Congruent, -Incongruent) %>%
group_by(time) %>%
spread(time, difference) %>%
as.data.frame()
estimates[[perm2]] <- cor.test(tmp[,2],tmp[,3])
})
setTxtProgressBar(pb2, perm2)
}
}
outlist$MULTIVERSEestimates <- estimates
outlist$estimates <- specs
if(test == "ICC2" | test == "ICC3") {
for(i in 1:nS) {
outlist$estimates$estimate[i] <- estimates[[i]]$ICC
outlist$estimates$low[i] <- estimates[[i]]$`lower bound`
outlist$estimates$high[i] <- estimates[[i]]$`upper bound`
}
}
if(test == "cor") {
for(i in 1:nS) {
outlist$estimates$estimate[i] <- estimates[[i]]$estimate
outlist$estimates$low[i] <- estimates[[i]]$conf.int[1]
outlist$estimates$high[i] <- estimates[[i]]$conf.int[2]
}
}
outlist$CI <- quantile(outlist$estimates$estimate, c(.025,.5, .975), na.rm = TRUE)
class(outlist) <- "multiverse"
return(outlist)
} |
library(testthat)
library(ggplot2)
library(ggtext)
test_check("ggtext") |
remove_file_extension=function(filename,extension_delimiter=".")
{
split_filename=unlist(strsplit(filename,extension_delimiter,fixed=TRUE))
split_filename_length=length(split_filename)
if(split_filename_length==1)
{
return(split_filename[1])
} else
{
return(paste(as.character(split_filename)[1:(split_filename_length-1)],collapse=extension_delimiter))
}
} |
pnchisq <- function(q, df, ncp = 0, lower.tail = TRUE,
cutOffncp = 80, itSimple = 110,
errmax = 1e-12, reltol = 1e-11,
maxit = 10* 10000,
verbose = 0, xLrg.sigma = 5)
{
Cat <- function(...) if(verbose > 0) cat(...)
if(length(q) != 1 || length(df) != 1 || length(ncp) != 1)
stop("arguments must have length 1 !")
x <- q
if(x <= 0) {
if(x == 0 && df == 0)
return(if(lower.tail) exp(-0.5*ncp) else -expm1(-0.5*ncp))
return(.DT_0(lower.tail, log.p=FALSE))
}
if(!is.finite(x))
return(.DT_1(lower.tail, log.p=FALSE))
lam <- 0.5 * ncp
if(ncp < cutOffncp) {
pr <- exp(-lam)
Cat(sprintf("pnchisq(x=%10g, ncp < cutoff): pr = %g ..", x, pr))
sum <- sum2 <- 0
for(i in 0:(itSimple-1)) {
sum2 <- sum2 + pr
sum <- sum+ pr * pchisq(x, df+2*i,
lower.tail=lower.tail, log.p=FALSE)
if (sum2 >= 1-1e-15) break
pr <- pr * lam/(i <- i+1)
}
Cat(sprintf(" ==> final pr=%g, i = %3d, sum2 = %18.16f\n", pr, i, sum2))
return(sum/sum2)
}
dbl.min.exp <- log(2) * .Machine$double.min.exp
lamSml <- (-lam < dbl.min.exp)
if (lamSml) {
Cat("large 'lambda' ==> working with ln(u)\n")
u <- 0
lu <- -lam
l.lam <- log(lam)
}
else
u <- exp(-lam)
v <- u
x2 <- 0.5* x
f2 <- 0.5* df
fx.2n <- df - x
if(f2 * .Machine$double.eps > 0.125 &&
abs(t <- x2 - f2) < sqrt(.Machine$double.eps) * f2) {
lt <- (1 - t)*(2 - t/(f2 + 1)) - 0.5 * log(2* pi*(f2 + 1))
Cat(" (case I) ==>")
}
else {
lt <- f2*log(x2) - x2 - lgamma(f2 + 1)
}
Cat(" lt=", formatC(lt))
tSml <- (lt < dbl.min.exp)
if (tSml) {
Cat(" => exp(lt) underflow protection")
if(x > df + ncp + xLrg.sigma * sqrt( 2*(df + 2*ncp))) {
Cat(" and x > E(X) + ",formatC(xLrg.sigma),
"*sigma(X) : too large --> 1 \n")
return(.DT_1(lower.tail, log.p=FALSE))
}
l.x <- log(x)
Cat(" ln(x)=",l.x,"\n")
ans <- term <- t <- 0
}
else {
t <- exp(lt)
Cat(", t=exp(lt)=", formatC(t),"\n")
ans <- term <- v * t
}
n <- 1
f2n <- df + 2
fx.2n <- fx.2n + 2
firstBound <- TRUE
while(TRUE) {
if(verbose >= 2) cat("_OL_: n=",n,"")
if (fx.2n > 0) {
if(firstBound) {
Cat(" n= ",n,", fx.2n = ",formatC(fx.2n)," > 0\n",sep='')
firstBound <- FALSE
}
bound <- t * x / fx.2n
is.r <- is.it <- FALSE
if (((is.b <- bound <= errmax) &&
(is.r <- term <= reltol * ans)) || (is.it <- n > maxit))
{
Cat("BREAK n=",n, if(is.it) "> maxit",
"; bound= ",formatC(bound), if(is.b)"<= errmax",
"rel.err= ",formatC(term/ans),if(is.r)"<= reltol\n")
break
}
}
if(lamSml) {
lu <- lu + l.lam - log(n)
if(lu >= dbl.min.exp) {
Cat(" n=",n,
"; nomore underflow in u = exp(lu) ==> change\n")
v <- u <- exp(lu)
lamSml <- FALSE
}
} else {
u <- u* lam / n
v <- v + u
}
if(tSml) {
lt <- lt + l.x - log(f2n)
if(lt >= dbl.min.exp) {
Cat(" n=",n,
"; nomore underflow in t = exp(lt) ==> change\n")
t <- exp(lt)
tSml <- FALSE
}
} else {
t <- t * (x / f2n)
}
if(!lamSml && !tSml) {
term <- v * t
if(verbose >= 2)
cat(" il: term=",formatC(term, width=10),
"rel.term=", formatC(term/ans, width=10),"\n")
ans <- ans + term
} else if(verbose >= 2) cat(".")
n <- n+1
f2n <- f2n + 2
fx.2n <- fx.2n + 2
}
if (bound > errmax) {
warning("pnchisq(x,....): not converged in ",maxit," iter.")
}
structure(.D_Lval(ans, lower.tail=lower.tail), iter = n)
}
pnchisqV <- function(x, ..., verbose = 0)
vapply(x, pnchisq, FUN.VALUE = 0.5, ..., verbose = verbose)
pnchisqPatnaik <- function(q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE)
{
e <- df + ncp
d <- e + ncp
ic <- e/d
pchisq(q*ic, df=e*ic, lower.tail=lower.tail, log.p=log.p)
}
pnchisqPearson <- function(q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE)
{
n2 <- df + 2*ncp
n3 <- n2 + ncp
r <- n2 / n3
pchisq((q + ncp/n3*ncp) *r, df = n2*r*r,
lower.tail=lower.tail, log.p=log.p)
}
pnchisqAbdelAty <- function(q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE)
{
r <- df + ncp
n2 <- r + ncp
V <- 2/9 * n2/r/r
sV <- sqrt(V)
if(any(off <- V < .Machine$double.xmin | V > .Machine$double.xmax))
sV[off] <- sqrt(2*n2[off]) / r[off] / 3
pnorm((q/r)^(1/3), mean = 1-V, sd = sV, lower.tail=lower.tail, log.p=log.p)
}
pnchisqSankaran_d <- function(q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE)
{
r <- df + ncp
n2 <- r + ncp
n3 <- n2 + ncp
q1 <- n2/r^2
h1 <- - 2/3 * r*n3/n2^2
h <- 1 + h1
mu <- 1 + h*h1*q1*(1 + (h-2)*(1-3*h)*q1/2)
sV <- h * sqrt(2*q1 * (1 + h1 * (1-3*h)*q1))
pnorm((q/r)^h, mean = mu, sd = sV,
lower.tail=lower.tail, log.p=log.p)
}
r_pois <- function(i, lambda)
{
if(lambda < -log(2)*.Machine$double.min.exp)
dpois(i, lambda) / ppois(i-1, lambda)
else
exp(i*log(lambda) - lgamma(i+1) + -lambda- ppois(i-1, lambda, log.p = TRUE))
}
r_pois_expr <-
expression(rr[lambda](i) ==
frac(lambda^i / i*"!",
1+ lambda+ lambda^2/2*"!" +cdots+ lambda^{i-1}/(i-1)*"!"))
plRpois <- function(lambda, iset = 1:(2*lambda), do.main=TRUE,
log = 'xy', type = "o", cex = 0.4, col = c("red","blue"),
do.eaxis = TRUE, sub10 = "10")
{
ii <- sort(iset)
if(do.main) {
pmar <- par("mar"); on.exit(par(mar=pmar))
par(mar=pmar + c(0,0,1.2,0))
}
plot(ii, r_pois(ii, lambda=lambda), log = log, cex = cex, col = col[1],
type = type, xlab = "i", ylab = quote(rr[lambda](i)),
sub = substitute(lambda==l, list(l=lambda)),
yaxt = if(do.eaxis) "n" else par("yaxt"),
main = if(do.main) r_pois_expr)
if(do.eaxis) eaxis(2, sub10=sub10)
lines(ii, lambda/ii, col = col[2])
legend(ii[length(ii)], lambda, expression(rr[lambda](i), lambda / i),
col = col, lty = 1, pch = c(1,NA), xjust = 1, bty = 'n')
}
pnchisqTerms <- function(x, df, ncp, lower.tail = TRUE, i.max = 1000)
{
if(length(x) > 1) stop("'x' must be of length 1")
if(length(df) > 1) stop("'df' must be of length 1")
if(length(ncp) > 1) stop("'ncp' must be of length 1")
stopifnot(length(i.max) == 1, i.max > 1)
lambda <- 0.5 * ncp
sum <- 0.
k <- 1:i.max
p.k <- dpois(k, lambda)
t.k <- pchisq(x, df + 2*(k-1), lower.tail=lower.tail, log.p=FALSE)
s.k <- p.k * t.k
kMax <- which.max(s.k)
list(p.k = p.k, t.k = t.k, s.k = s.k, kMax = kMax,
f = sum(s.k[1:kMax]) + sum(s.k[i.max:(kMax+1L)]))
}
ss <- function(x, df, ncp, i.max = 10000,
useLv = !(expMin < -lambda && 1/lambda < expMax))
{
if(length(x) != 1) stop("'x' must be of length 1")
if(length(df) != 1) stop("'df' must be of length 1")
if(length(ncp) != 1) stop("'ncp' must be of length 1")
if(x <= 0) stop("'x' must be positive (here)")
expMin <- log(2)*.Machine$double.min.exp
expMax <- log(2)*.Machine$double.max.exp
lambda <- ncp/2
i <- 1:i.max
xq <- x / (df + 2*i)
tt <- cumprod(c(1, xq))
useLt <- any(it0 <- tt < .Machine$double.xmin)
if(useLt) {
ltt <- cumsum(c(0, log(xq)))
}
if(!useLv) {
u <- exp(-lambda)*cumprod(c(1, lambda / i))
v <- cumsum(u)
} else {
luPl <- c(0,i*log(lambda)) + cumsum(c(0, - log(i)))
useLv <- useLt || any(luPl - lambda < expMin)
if(useLv) {
lv <- -lambda + log(cumsum(exp(luPl)))
if(!useLt)
ltt <- cumsum(c(0, log(xq)))
}
else
v <- cumsum(exp(luPl -lambda))
}
if(useLv)
r <- exp(ltt + lv)
else {
if(useLt && any(it0 <- it0 & v != 0))
tt[it0] <- exp(ltt[it0])
r <- tt * v
}
d <- diff(r > 0)
i1 <- which.max(d)
i2 <- i.max+1 - which.min(rev(d))
r <- r[1:i2]
list(s = r, i1 = i1, max = which.max(r))
}
ss2 <- function(x, df, ncp, i.max = 10000, eps = .Machine$double.eps)
{
sss <- ss(x,df,ncp,i.max)
s <- sss$s
i.need <- range(which(s > eps * s[sss$max]))
c(i1=sss$i1, i2=length(s), iN = i.need, max = sss$max)
}
pnchisq_ss <- function(x, df, ncp = 0, lower.tail=TRUE, log.p=FALSE, i.max = 10000) {
if(length(x) != 1) stop("'x' must be of length 1")
if(length(df) != 1) stop("'df' must be of length 1")
if(x <= 0) {
if(x == 0 && df == 0)
return(
if(log.p) {
if(lower.tail) -0.5*ncp else log1mexp(+0.5*ncp)
} else {
if(lower.tail) exp(-0.5*ncp) else -expm1(-0.5*ncp)
})
return(.DT_0(lower.tail, log.p=log.p))
}
if(!is.finite(x))
return(.DT_1(lower.tail, log.p=log.p))
si <- ss(x=x, df=df, ncp=ncp, i.max = i.max)
f <- if(log.p) log(2) + dchisq(x, df = df+2, log=TRUE)
else 2 * dchisq(x, df = df+2)
s <- sum(si$s)
if(lower.tail) {
if(log.p) f+log(s) else f*s
} else {
if(log.p) log1p(- f*s) else 1 - f*s
}
}
pnchisqIT <- function(q, df, ncp = 0, errmax = 1e-12,
reltol = 2*.Machine$double.eps, maxit = 1e5, verbose = FALSE)
{
if(length(q) != 1 || length(df) != 1 || length(ncp) != 1)
stop("arguments must have length 1 !")
r <- .C(C_Pnchisq_it,
x = as.double(q),
f = as.double(df),
theta = as.double(ncp),
errmax = as.double(errmax),
reltol = as.double(reltol),
maxit = as.integer(maxit),
verbose = as.integer(verbose),
i0 = integer(1),
n.terms = integer(1),
terms = double(maxit+1),
prob = double(1))
length(r$terms) <- r$n.terms
r[c("prob", "i0", "n.terms", "terms")]
}
ss2. <- function(q, df, ncp = 0, errmax = 1e-12,
reltol = 2*.Machine$double.eps, maxit = 1e5,
eps = reltol, verbose = FALSE)
{
if(length(q) != 1 || length(df) != 1 || length(ncp) != 1)
stop("arguments must have length 1 !")
r <- .C(C_Pnchisq_it,
x = as.double(q),
f = as.double(df),
theta = as.double(ncp),
errmax = as.double(errmax),
reltol = as.double(reltol),
maxit = as.integer(maxit),
verbose = as.integer(verbose),
i0 = integer(1L),
n.terms = integer(1L),
terms = double(maxit+1L)
, prob = double(1)
)
length(r$terms) <- r$n.terms
nT <- length(s <- r$terms)
if(nT > 1) {
d <- diff(s > 0)
if(sum(diff(sign(d))) > 1) warning("more than local extremum")
i1 <- which.max(d)
i2 <- nT+1 - which.min(rev(d))
if(i2 != nT) { warning("i2 == ",i2," != nT = ",nT) ; s <- s[1:i2] }
iMax <- which.max(s)
i.need <- range(which(s > eps * s[iMax]))
if(i2 != i.need[2]
&&
i2 != i.need[2]+1) warning("i2 == ",i2," != iN[2] = ",i.need[2])
} else {
i1 <- i2 <- NA
iMax <- 1
i.need <- c(1,1)
}
c(i0 = r$i0, nT = r$n.terms, i1=i1, i2=i2, iN = i.need, iMax = iMax)
}
small.ncp.logspaceR2015 <- function(x, df, ncp, lower.tail, log.p) {
lower.tail & df > 0 & {
log(x) < log(2) + 2/df*(lgamma(df/2. + 1) + M_minExp)
}
}
pnchisqRC <- function(q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE,
no2nd.call = FALSE,
cutOffncp = 80, small.ncp.logspace = small.ncp.logspaceR2015, itSimple = 110,
errmax = 1e-12, reltol = 8*.Machine$double.eps, epsS = reltol/2,
maxit = 1000000, verbose = FALSE)
{
if(is.function(small.ncp.logspace))
small.ncp.logspace <- small.ncp.logspace(q, df, ncp, lower.tail, log.p)
stopifnot(is.logical(small.ncp.logspace))
.Call(C_Pnchisq_R,
as.double(q), as.double(df), as.double(ncp), lower.tail, log.p,
no2nd.call, cutOffncp, small.ncp.logspace, itSimple,
errmax, reltol, epsS, maxit, verbose)
}
pnchisqT93.a <- function(q, df, ncp, lower.tail = TRUE, log.p = FALSE) {
if(!all(length(q), length(df), length(ncp))) return(q+df+ncp)
stopifnot(ncp > 0, length(lower.tail) == 1L, length(log.p) == 1L)
if(log.p && !lower.tail) {
ok <- .Machine$double.xmin <= (r <- q/ncp) & r <= .Machine$double.xmax
r[ ok] <- log(r[ok])
r[!ok] <- log(q[!ok]) - log(ncp[!ok])
((df - 1)/4) * r + pnorm(sqrt(2*q) - sqrt(2*ncp), lower.tail=FALSE, log.p=TRUE)
}
else {
Ip <- (q/ncp)^((df - 1)/4) * pnorm(sqrt(2*q) - sqrt(2*ncp), lower.tail=FALSE)
if(log.p)
log1p(-Ip)
else {
if(lower.tail) 1 - Ip else Ip
}
}
}
pnchisqT93.b <- function(q, df, ncp, lower.tail = TRUE, log.p = FALSE) {
if(!all(length(q), length(df), length(ncp))) return(q+df+ncp)
stopifnot(ncp > 0, length(lower.tail) == 1L, length(log.p) == 1L)
if(log.p && lower.tail) {
ok <- .Machine$double.xmin <= (r <- q/ncp) & r <= .Machine$double.xmax
r[ ok] <- log(r[ok])
r[!ok] <- log(q[!ok]) - log(ncp[!ok])
((df - 1)/4) * r + pnorm(sqrt(2*ncp) - sqrt(2*q), lower.tail=FALSE, log.p=TRUE)
}
else {
p <- (q/ncp)^((df - 1)/4) * pnorm(sqrt(2*ncp) - sqrt(2*q), lower.tail=FALSE)
if(log.p)
log1p(-p)
else {
if(lower.tail) p else 1 - p
}
}
}
pnchisqT93 <- function(q, df, ncp, lower.tail = TRUE, log.p = FALSE,
use.a = q > ncp)
{
stopifnot(ncp > 0, !anyNA(a <- use.a))
if(!length(a) || !(n <- length(ncp))) return(numeric(0))
if(missing(a)) {
if(n < length( q)) n <- length(q)
if(n < length(df)) n <- length(df)
}
if(n < length(a)) n <- length(a)
else if(
length( a) < n) a <- rep_len(a, n)
if(length( q) < n) q <- rep_len(q, n)
if(length( df) < n) df <- rep_len(df, n)
if(length(ncp) < n) ncp <- rep_len(ncp, n)
r <- q
r[ a] <- pnchisqT93.a(q[ a], df[ a], ncp[ a], lower.tail=lower.tail, log.p=log.p)
r[!a] <- pnchisqT93.b(q[!a], df[!a], ncp[!a], lower.tail=lower.tail, log.p=log.p)
r
}
pnchisqBolKuz <- function(q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE)
{
stopifnot(df > 0)
lnu <- ncp/df
w. <- q*(1 + lnu*(-1 + .5*lnu*(1 + q/(df+2))))
pchisq(w., df=df, lower.tail=lower.tail, log.p=log.p)
}
pnchi1sq <- function(q, ncp = 0, lower.tail = TRUE, log.p = FALSE, epsS = .01)
{
if(!lower.tail) stop("'lower.tail=FALSE' not yet implemented")
if(log.p) stop("'log.p = TRUE' not yet implemented")
sq <- sqrt(q)
sl <- sqrt(ncp)
sml <- sq <= sl * epsS
r <- numeric(length(sml))
if(any(sml)) {
N <- which(sml)
s <- rep_len(sq, length(r))[N]
sl. <- rep_len(sl, length(r))[N]
ncp. <- rep_len(ncp,length(r))[N]
r[N] <- 2*s*dnorm(sl.)*(1 + s/6*s*((ncp. - 1) + s/20*s*((ncp. - 6)*ncp. + 3)))
}
if(any(!sml)) {
N <- !sml
D <- (sl-sq)[N]
P <- (sl+sq)[N]
r[N] <- pnorm(-D) - pnorm(-P)
}
r
}
pnchi3sq <- function(q, ncp = 0, lower.tail = TRUE, log.p = FALSE, epsS = 0.04)
{
if(!lower.tail) stop("'lower.tail=FALSE' not yet implemented")
if(log.p) stop("'log.p = TRUE' not yet implemented")
sq <- sqrt(q)
sl <- sqrt(ncp)
sml <- sq <= sl * epsS
r <- numeric(length(sml))
if(any(sml)) {
N <- which(sml)
s <- rep_len(sq, length(r))[N]
sl. <- rep_len(sl, length(r))[N]
ncp. <- rep_len(ncp,length(r))[N]
s2 <- s^2
r[N] <- 2/3*s*s2*dnorm(sl.)*
(1 + s2/10*(ncp. - 3 + s2/28*(ncp.*(ncp. - 10) + 15)))
}
if(any(!sml)) {
N <- which(!sml)
sl. <- rep_len(sl, length(r))[N]
D <- (sl - sq)[N]
P <- (sl + sq)[N]
r[N] <- pnorm(-D) - pnorm(-P) + (dnorm(P) - dnorm(D)) / sl.
}
r
} |
chart.Drawdown <-
function (R, geometric = TRUE, legend.loc = NULL, colorset = (1:12), plot.engine = "default",...)
{
if(plot.engine != "default"&&
plot.engine != "dygraph"&&
plot.engine != "ggplot2"&&
plot.engine != "plotly"&&
plot.engine != "googlevis"){
warning('Please use correct arguments:
"default","dygraph","ggplot2","plotly","googlevis".
Ploting chart using built-in engine now.')
plot.engine = "default"
}
drawdown = Drawdowns(R, geometric)
if(NCOL(R)==1)
{
drawdown<-as.xts(drawdown)
colnames(drawdown)<-colnames(R)
}
if(plot.engine == "default"){
if(hasArg("add")) {
plotargs <- list(...)
plotargs$add <- NULL
plotcall <- match.call()
colset <- eval.parent(plotcall$colorset)
p <- addSeries(drawdown, col = colset, legend.loc = legend.loc, main = plotargs$main)
} else
p <- chart.TimeSeries(drawdown,
colorset = colorset,
legend.loc = legend.loc,
plot.engine = plot.engine,
...)}
else{
p <- chart.TimeSeries(drawdown,
plot.engine = plot.engine,
...)
}
return(p)
} |
hill_climb_step2 <- function(mtx, R){
NodesA <- nrow(mtx)
NodesB <- ncol(mtx)
oPosList <- get_valid_ones_cpp(mtx)
support_data <- init_nodf(mtx)
MT <- support_data[[1]]
Fill <- support_data[[2]]
DM <- support_data[[3]]
ND <- support_data[[4]]
S <- support_data[[5]]
mt_0 <- as.vector(MT[[1]])
mt_t <- as.vector(MT[[2]])
F0 <- Fill[[1]][,]
Ft <- Fill[[2]][,]
DM0 <- DM[[1]][,]
DMt <- DM[[2]][,]
ND0 <- ND[[1]]*1
NDt <- ND[[2]]*1
opt_mtx <- mtx[,]
opt_nodf <- nodf_cpp(opt_mtx)
tp <- utils::txtProgressBar(min = 1, max = nrow(oPosList), style = 3)
for(idx in 1:nrow(oPosList)){
utils::setTxtProgressBar(tp, idx)
opos <- oPosList[idx,]
for(xshift in -R:R){
for(yshift in -R:R){
newx <- opos[1] + xshift
newy <- opos[2] + yshift
if(newx>= 1 & newx <= NodesA & newy >= 1 & newy <= NodesB){
if(mtx[newx, newy] == 0){
zpos <- c(newx, newy)
nodf <- nodf_neighbor2(mtx,opos,zpos,mt_0,mt_t,F0,Ft,DM0,DMt,ND0,NDt,S)
if(nodf > opt_nodf){
opt_mtx <- mtx[,]
opt_nodf <- nodf
}
nodf_neighbor2(mtx,zpos,opos,mt_0,mt_t,F0,Ft,DM0,DMt,ND0,NDt,S)
}
}
}
}
}
return(opt_mtx)
}
full_hill_climb <- function(mtx, R=1){
old_nodf <- -100.0
count <- 0
while(old_nodf < nodf_cpp(mtx)){
count <- count + 1
old_nodf <- nodf_cpp(mtx)
mtx <- hill_climb_step2(mtx, R)
}
return(mtx)
} |
"SpatialMultiPointsDataFrame" = function(coords, data,
proj4string = CRS(as.character(NA)), match.ID, bbox = NULL) {
if (is(coords, "SpatialMultiPoints") &&
!is.na(slot(proj4string, "projargs")))
warning("If the coords argument is a SpatialMultiPoints object, set its CRS first;\n the proj4string argument to this function is ignored.")
if (!is(coords, "SpatialMultiPoints"))
coords = SpatialMultiPoints(coords, proj4string = proj4string, bbox = bbox)
mtch = NULL
cc.ID = names(coords@coords)
if (missing(match.ID)) {
if (is.null(cc.ID) || any(cc.ID == ""))
match.ID = FALSE
else {
mtch = match(cc.ID, row.names(data))
match.ID = !any(is.na(mtch))
if (match.ID && any(mtch != 1:nrow(data)))
warning("forming a SpatialMultiPointsDataFrame based on maching IDs, not on record order. Use match.ID = FALSE to match on record order")
}
} else if (is.character(match.ID)) {
row.names(data) = data[, match.ID[1]]
match.ID = TRUE
}
if (match.ID) {
if (!is.null(cc.ID) && is(data, "data.frame")) {
if (is.null(mtch))
mtch = match(cc.ID, row.names(data))
if (any(is.na(mtch)))
stop("row.names of data and coords do not match")
if (length(unique(mtch)) != nrow(data))
stop("row.names of data and dimnames of coords do not match")
data = data[mtch, , drop = FALSE]
}
}
if (is.character(attr(data, "row.names")))
names(coords@coords) = row.names(data)
new("SpatialMultiPointsDataFrame", coords, data = data)
}
setMethod("addAttrToGeom", signature(x = "SpatialMultiPoints", y = "data.frame"),
function(x, y, match.ID, ...)
SpatialMultiPointsDataFrame(x, y, match.ID = match.ID, ...)
)
.asWKT = FALSE
print.SpatialMultiPointsDataFrame = function(x, ..., digits = getOption("digits"),
asWKT = .asWKT) {
if (asWKT)
df = data.frame(asWKTSpatialMultiPoints(x, digits), x@data)
else {
cc = substring(paste(as.data.frame(
t(signif(coordinates(x), digits)))),2,999)
ix = rep(seq_along(x@coords), sapply(x@coords, nrow))
df = data.frame("coordinates" = cc, x@data[ix, , drop=FALSE])
}
print(df, ..., digits = digits)
}
setMethod("show", "SpatialMultiPointsDataFrame", function(object) print(object))
dim.SpatialMultiPointsDataFrame = function(x) dim(x@data)
as.data.frame.SpatialMultiPointsDataFrame = function(x, ...) {
l = sapply(x@coords, nrow)
ix = rep(1:length(l), l)
data.frame(coordinates(x), index = ix, x@data[ix,,drop=FALSE], ...)
}
setAs("SpatialMultiPointsDataFrame", "data.frame", function(from)
as.data.frame.SpatialMultiPointsDataFrame(from))
names.SpatialMultiPointsDataFrame <- function(x) names(x@data)
"names<-.SpatialMultiPointsDataFrame" <- function(x, value) {
checkNames(value)
names(x@data) = value
x
}
points.SpatialMultiPointsDataFrame = function(x, y = NULL, ...)
points(as(x, "SpatialMultiPoints"), ...)
text.SpatialMultiPointsDataFrame = function(x, ...) {
lst = list(x = coordinates(x), ...)
if (!is.null(x$pos) && is.null(lst$pos))
lst$pos = x$pos
if (!is.null(x$offset) && is.null(lst$offset))
lst$offset = x$offset
if (!is.null(x$labels) && is.null(lst$labels))
lst$labels = parse(text = x$lab)
do.call(text, lst)
}
setMethod("[", "SpatialMultiPointsDataFrame", function(x, i, j, ..., drop = TRUE) {
missing.i = missing(i)
missing.j = missing(j)
nargs = nargs()
if (missing.i && missing.j) {
i = TRUE
j = TRUE
} else if (missing.j && !missing.i) {
if (nargs == 2) {
j = i
i = TRUE
} else {
j = TRUE
}
} else if (missing.i && !missing.j)
i = TRUE
if (is.matrix(i))
stop("matrix argument not supported in SpatialMultiPointsDataFrame selection")
if (is(i, "Spatial"))
i = !is.na(over(x, geometry(i)))
if (is.character(i))
i <- match(i, row.names(x))
if (any(is.na(i)))
stop("NAs not permitted in row index")
x@coords = x@coords[i]
if (length(x@coords))
x@bbox = .bboxMultiCoords(x@coords)
x@data = x@data[i, j, ..., drop = FALSE]
x
})
setMethod("geometry", "SpatialMultiPointsDataFrame",
function(obj) as(obj, "SpatialMultiPoints"))
length.SpatialMultiPointsDataFrame = function(x) { length(x@coords) }
setAs("SpatialMultiPointsDataFrame", "SpatialPointsDataFrame",
function(from) {
l = sapply(from@coords, nrow)
ix = rep(1:length(l), l)
new("SpatialPointsDataFrame", as(geometry(from), "SpatialPoints"),
data = from@data[ix,,drop=FALSE], coords.nrs = numeric(0))
}
) |
dbConnect_DBIConnector <- function(drv, ...) {
dots_args <- list(...)
has_name <- names2(dots_args) != ""
unnamed_dots <- dots_args[!has_name]
named_dots <- dots_args[has_name]
named_dots$drv <- NULL
extra_args <- utils::modifyList(
dbGetConnectArgs(drv),
named_dots
)
all_args <- c(
list(drv = [email protected]),
unnamed_dots,
extra_args
)
do.call(dbConnect, all_args)
}
setMethod("dbConnect", signature("DBIConnector"), dbConnect_DBIConnector) |
bs_button <- function(
label,
button_type = c("default", "primary", "success", "info", "warning", "danger"),
button_size = c("default", "large", "small", "extra-small"),
...
){
button_type <- match.arg(button_type)
button_size <- match.arg(button_size)
class_button_size <-
list(
default = NULL,
large = "btn-lg",
small = "btn-sm",
`extra-small` = "btn-xs"
)
htmltools::tags$button(
label,
class =
paste(
c(
"btn",
paste("btn", button_type, sep = "-"),
class_button_size[[button_size]]
),
collapse = " "
),
...
)
} |
prep_Cuminc_df <- function(x,
shift_vars,
conf.type,
conf.int) {
. <- prob <- se <- NULL
prob_cols <- grep(x = names(x), pattern = "^CI", value = TRUE)
se_cols <- grep(x = names(x), pattern = "^seCI", value = TRUE)
df_long <- data.table::melt.data.table(
data = data.table::data.table(x),
measure.vars = list(prob_cols, se_cols),
value.name = c("prob", "se"),
variable.name = "state"
)
df_long[, ':=' (
CI_low = make_prob_confint(prob, se, conf.type, conf.int, bound = "low"),
CI_upp = make_prob_confint(prob, se, conf.type, conf.int, bound = "upp")
), by = shift_vars]
df_steps <- rbind(df_long, df_long)
data.table::setorder(x = df_steps, time)
df_steps[, time := data.table::shift(
x = time,
fill = NA,
n = 1,
type = "lead"
), by = shift_vars]
return(df_steps[!is.na(time)])
}
ggplot.Cuminc <- function(x,
xlab = "Time",
ylab = "Probability",
xlim,
ylim,
lty,
legend,
cols,
conf.type = "log",
conf.int = 0.95,
legend.pos = "right",
facet = FALSE) {
if (!requireNamespace("ggplot2", quietly = TRUE)) {
stop("Package ggplot2 needed for this function to work. Please install it.", call. = FALSE)
}
state.grp <- state <- group <- NULL
shift_vars <- if ("group" %in% names(x)) c("state", "group") else "state"
if (facet & length(shift_vars) == 1) stop("Cannot facet for Cuminc object without group specified")
df_steps <- prep_Cuminc_df(
x = x,
shift_vars = shift_vars,
conf.type = conf.type,
conf.int = conf.int
)
if (!facet & length(shift_vars) > 1) {
df_steps[, state.grp := interaction(state, group)]
grp <- rlang::sym("state.grp")
} else grp <- rlang::sym("state")
n_grps_plotted <- length(unique(df_steps[[grp]]))
if (missing(xlim)) xlim <- c(0, max(df_steps$time))
if (missing(ylim)) ylim <- c(0, 1)
if (missing(lty)) lty <- rep(1, n_grps_plotted)
if (missing(legend)) legend <- levels(factor(df_steps[[grp]]))
if (missing(cols)) cols <- set_colours(n_grps_plotted, type = "lines")
col_ribb <- ifelse(conf.type == "none", NA, "grey70")
p <- ggplot2::ggplot(
data = df_steps,
ggplot2::aes(
x = .data$time,
y = .data$prob,
col = !!grp,
group = !!grp,
linetype = !!grp
)
) +
ggplot2::geom_ribbon(
ggplot2::aes(ymin = .data$CI_low, ymax = .data$CI_upp),
fill = col_ribb,
col = NA,
alpha = 0.5
) +
ggplot2::geom_line(size = 1) +
ggplot2::coord_cartesian(xlim = xlim, ylim = ylim, expand = 0) +
ggplot2::scale_linetype_manual(values = lty, labels = legend) +
ggplot2::scale_color_manual(values = cols, labels = legend) +
ggplot2::theme(legend.position = legend.pos) +
ggplot2::labs(x = xlab, y = ylab)
if (facet) {
p <- p + ggplot2::facet_wrap(. ~ group)
}
return(p)
} |
SQL <- function(x, ..., names = NULL) {
if (!is.null(names)) {
stopifnot(length(x) == length(names))
}
names(x) <- names
new("SQL", x)
}
setClass("SQL", contains = "character")
`[.SQL` <- function(x, ...) SQL(NextMethod())
`[[.SQL` <- function(x, ...) SQL(NextMethod()) |
test_that("websites can be created", {
skip_if_pandoc_not_installed()
expect_error({
on.exit(unlink("testsite", recursive = TRUE), add = TRUE)
create_website("testsite", "Test Site", edit = FALSE)
}, NA)
}) |
sim_pet <- function(phy, map, model, pars, ntips, bounds){
norm_pars <- norm_func(model)
x.val <- numeric(phy$Nnode + ntips)
x.val[ntips+1] <- pars["root"]
names(x.val) <- c(phy$tip.label, as.character(ntips + 1:phy$Nnode))
for(i in order(phy$edge[,1])){
if("WN" %in% model & phy$edge[i,1] > ntips + 1){
map[[i]] <- c(map[[which(phy$edge[,2] == phy$edge[i,1])]], map[[i]])
}
x.val[phy$edge[i,2]] <- x.val[phy$edge[i,1]]
for(j in 1:length(map[[i]])){
x <- x.val[phy$edge[i,2]]
t <- map[[i]][j]
reg <- as.numeric(names(map[[i]])[j])
n.pars <- norm_pars(x, pars, t)
x.val[phy$edge[i,2]] <- reflect(rnorm(1, n.pars[reg,1], sqrt(n.pars[reg,2])), bounds)
}
}
return(x.val)
}
norm_func <- function(model){
if(any(c("BM", "WN") %in% model)){
out <- function(x, pars, t){
sig2 <- pars[grepl("sigma_sq", names(pars))]
cbind(x, sig2*t)
}
}
if("OU" %in% model){
out <- function(x, pars, t){
the <- pars[grepl("theta", names(pars))]
sig2 <- pars[grepl("sigma_sq", names(pars))]
alp <- pars[grepl("alpha", names(pars))]
cbind(the + (the - x) * exp(-alp * t), (sig2/(2*alp)) * (1 - exp(-2 * alp * t)))
}
}
return(out)
}
reflect <- function(yy, bounds) {
while (yy < bounds[1] || yy > bounds[2]) {
if (yy < bounds[1])
yy <- 2 * bounds[1] - yy
if (yy > bounds[2])
yy <- 2 * bounds[2] - yy
}
return(yy)
} |
context("Estimation with loss to follow-up censoring")
library(data.table)
set.seed(172943)
n <- 100
W <- data.frame(W1 = runif(n), W2 = rbinom(n, 1, 0.7))
A <- rpois(n, lambda = exp(3 + .3 * log(W$W1) - 0.2 * exp(W$W1) * W$W2))
C_cens <- rbinom(n, 1, plogis(rowSums(W) - 1))
Y <- rbinom(
n, 1,
plogis(-1 + 0.05 * A - 0.02 * A * W$W2 + 0.2 * A * tan(W$W1^2) -
0.02 * W$W1 * W$W2 + 0.1 * A * W$W1 * W$W2)
)
C_samp <- rbinom(n, 1, plogis(rowSums(W) + Y))
V <- as.data.table(list(W, Y = Y))
delta_shift <- 2
gn_exp_hal <- est_g_exp(
A = A, W = W,
delta = delta_shift,
fit_type = "hal",
haldensify_args = list(
n_bins = 5,
grid_type = "equal_mass",
lambda_seq = exp(seq(-1, -10, length = 300)),
max_degree = 3, smoothness_orders = 0, num_knots = NULL,
reduce_basis = 1 / sqrt(length(A))
)
)
gn_cens_glm <- est_g_cens(
C_cens = C_cens, A = A, W = W,
fit_type = "glm"
)
Qn_est_glm <- est_Q(
Y = Y, C_cens = C_cens, A = A, W = W, delta = delta_shift,
fit_type = "glm", glm_formula = "Y ~ ."
)
ipcw_est_glm <- est_samp(V = V, C_samp = C_samp, fit_type = "glm")
tmle_glm <- txshift(
Y = Y, C_cens = C_cens, A = A, W = W, delta = delta_shift,
g_exp_fit_args = list(fit_type = "external"),
gn_exp_fit_ext = gn_exp_hal,
g_cens_fit_args = list(fit_type = "external"),
gn_cens_fit_ext = gn_cens_glm,
Q_fit_args = list(fit_type = "external"),
Qn_fit_ext = Qn_est_glm,
estimator = "tmle"
)
os_glm <- txshift(
Y = Y, C_cens, A = A, W = W, delta = delta_shift,
g_exp_fit_args = list(fit_type = "external"),
gn_exp_fit_ext = gn_exp_hal,
g_cens_fit_args = list(fit_type = "external"),
gn_cens_fit_ext = gn_cens_glm,
Q_fit_args = list(fit_type = "external"),
Qn_fit_ext = Qn_est_glm,
estimator = "onestep"
)
test_that("TMLE and one-step match for GLM nuisance configurations", {
tmle_glm_psi <- as.numeric(tmle_glm$psi)
os_glm_psi <- as.numeric(os_glm$psi)
expect_equal(tmle_glm_psi, os_glm_psi, tol = 1e-3)
})
ipcw_tmle_glm <- txshift(
W = W, A = A, Y = Y, delta = delta_shift,
C_samp = C_samp, V = c("W", "Y"),
estimator = "tmle",
max_iter = 5,
samp_fit_args = list(fit_type = "external"),
samp_fit_ext = ipcw_est_glm,
g_exp_fit_args = list(fit_type = "external"),
gn_exp_fit_ext = gn_exp_hal[C_samp == 1, ],
Q_fit_args = list(fit_type = "external"),
Qn_fit_ext = Qn_est_glm[C_samp == 1, ],
eif_reg_type = "hal"
)
ipcw_os_glm <- txshift(
W = W, A = A, Y = Y, delta = delta_shift,
C_samp = C_samp, V = c("W", "Y"),
estimator = "onestep",
samp_fit_args = list(fit_type = "external"),
samp_fit_ext = ipcw_est_glm,
g_exp_fit_args = list(fit_type = "external"),
gn_exp_fit_ext = gn_exp_hal[C_samp == 1, ],
Q_fit_args = list(fit_type = "external"),
Qn_fit_ext = Qn_est_glm[C_samp == 1, ],
eif_reg_type = "hal"
)
test_that("IPCW-TMLE and IPCW-one-step match with GLM for censoring", {
ipcw_tmle_glm_psi <- as.numeric(ipcw_tmle_glm$psi)
ipcw_os_glm_psi <- as.numeric(ipcw_os_glm$psi)
expect_equal(ipcw_tmle_glm_psi, ipcw_os_glm_psi, tol = 5e-2)
})
if (require("sl3")) {
mean_learner <- Lrnr_mean$new()
glm_learner <- Lrnr_glm$new()
rf_learner <- Lrnr_ranger$new()
Q_lib <- Stack$new(mean_learner, glm_learner, rf_learner)
sl <- Lrnr_sl$new(learners = Q_lib, metalearner = Lrnr_nnls$new())
hose_learner <- make_learner(Lrnr_density_semiparametric,
mean_learner = glm_learner
)
hese_learner <- make_learner(Lrnr_density_semiparametric,
mean_learner = rf_learner,
var_learner = glm_learner
)
g_lib <- Stack$new(hose_learner, hese_learner)
sl_density <- Lrnr_sl$new(
learners = g_lib,
metalearner = Lrnr_solnp_density$new()
)
gn_exp_sl <- est_g_exp(
A = A, W = W,
delta = delta_shift,
fit_type = "sl",
sl_learners_density = sl_density
)
gn_cens_sl <- est_g_cens(
C_cens = C_cens, A = A, W = W,
fit_type = "sl",
sl_learners = sl
)
Qn_est_sl <- est_Q(
Y = Y, A = A, W = W, delta = delta_shift,
fit_type = "sl", sl_learners = sl
)
ipcw_est_sl <- est_samp(
V = V, C_samp = C_samp, fit_type = "sl",
sl_learners = sl
)
test_that("SL-based nuisance estimation fails without SL library", {
expect_error(est_g_exp(A = A, W = W, delta = delta_shift, fit_type = "sl"))
expect_error(est_g_cens(C_cens = C_cens, A = A, W = W, fit_type = "sl"))
expect_error(est_Q(A = A, W = W, delta = delta_shift, fit_type = "sl"))
expect_error(est_samp(A = A, W = W, delta = delta_shift, fit_type = "sl"))
})
tmle_ml <- txshift(
Y = Y, C_cens = C_cens, A = A, W = W, delta = delta_shift,
g_exp_fit_args = list(fit_type = "external"),
gn_exp_fit_ext = gn_exp_sl,
g_cens_fit_args = list(fit_type = "external"),
gn_cens_fit_ext = gn_cens_sl,
Q_fit_args = list(fit_type = "external"),
Qn_fit_ext = Qn_est_sl,
estimator = "tmle"
)
os_ml <- txshift(
Y = Y, C_cens = C_cens, A = A, W = W, delta = delta_shift,
g_exp_fit_args = list(fit_type = "external"),
gn_exp_fit_ext = gn_exp_sl,
g_cens_fit_args = list(fit_type = "external"),
gn_cens_fit_ext = gn_cens_sl,
Q_fit_args = list(fit_type = "external"),
Qn_fit_ext = Qn_est_sl,
estimator = "onestep"
)
test_that("TMLE and one-step match for SL nuisance configurations", {
tmle_ml_psi <- as.numeric(tmle_ml$psi)
os_ml_psi <- as.numeric(os_ml$psi)
expect_equal(tmle_ml_psi, os_ml_psi, tol = 1e-1)
})
ipcw_tmle_sl <- txshift(
W = W, A = A, C_cens = C_cens, Y = Y, delta = delta_shift,
C_samp = C_samp, V = c("W", "Y"),
estimator = "tmle", max_iter = 5,
samp_fit_args = list(fit_type = "external"),
samp_fit_ext = ipcw_est_sl,
g_exp_fit_args = list(fit_type = "external"),
gn_exp_fit_ext = gn_exp_sl[C_samp == 1, ],
g_cens_fit_args = list(fit_type = "external"),
gn_cens_fit_ext = gn_cens_sl[C_samp == 1],
Q_fit_args = list(fit_type = "external"),
Qn_fit_ext = Qn_est_sl[C_samp == 1, ],
eif_reg_type = "hal"
)
ipcw_os_sl <- txshift(
W = W, A = A, C_cens = C_cens, Y = Y, delta = delta_shift,
C_samp = C_samp, V = c("W", "Y"),
estimator = "onestep",
samp_fit_args = list(fit_type = "external"),
samp_fit_ext = ipcw_est_sl,
g_exp_fit_args = list(fit_type = "external"),
gn_exp_fit_ext = gn_exp_sl[C_samp == 1, ],
g_cens_fit_args = list(fit_type = "external"),
gn_cens_fit_ext = gn_cens_sl[C_samp == 1],
Q_fit_args = list(fit_type = "external"),
Qn_fit_ext = Qn_est_sl[C_samp == 1, ],
eif_reg_type = "hal"
)
test_that("IPCW-TMLE and IPCW-one-step match with SL for sampling", {
ipcw_tmle_sl_psi <- as.numeric(ipcw_tmle_sl$psi)
ipcw_os_sl_psi <- as.numeric(ipcw_os_sl$psi)
expect_equal(ipcw_tmle_sl_psi, ipcw_os_sl_psi, tol = 1e-2)
})
} |
setConstructorS3("FileIntegerMatrix", function(...) {
extend(FileMatrix(..., bytesPerCell=4, storageMode="integer"), "FileIntegerMatrix")
}) |
source(system.file("extdata", "utils.R", package = "nhdplusTools"))
if(!exists("work_dir")) {
work_dir <- file.path(tempdir(check = TRUE), "nhdplusTools")
}
if(!file.exists(file.path(work_dir, "03_sub.gpkg"))) {
download_pkg_data("03_sub.zip", "https://usgs-r.github.io/nhdplusTools/data/03_sub.zip", work_dir)
}
hr_source <- file.path(work_dir, "03_sub.gpkg")
hr_gpkg <- file.path(work_dir, "hr_data.gpkg")
hr_data <- get_nhdplushr(work_dir, layers = NULL,
out_gpkg = hr_gpkg,
pattern = "03_sub.gpkg") |
library("testthat")
library("dbscan")
context("sNN")
set.seed(665544)
n <- 1000
x <- cbind(
x = runif(10, 0, 10) + rnorm(n, sd = 0.2),
y = runif(10, 0, 10) + rnorm(n, sd = 0.2),
z = runif(10, 0, 10) + rnorm(n, sd = 0.2)
)
x <- x[!duplicated(x),]
rownames(x) <- paste("Object_", 1:nrow(x), sep="")
k <- 5L
nn <- dbscan::sNN(x, k=k, sort = TRUE)
expect_equal(nn$k, k)
expect_equal(dim(nn$dist), c(nrow(x), k))
expect_equal(dim(nn$id), c(nrow(x), k))
nn_d <- dbscan::sNN(dist(x), k, sort = TRUE)
expect_equal(nn, nn_d)
nn_d2 <- dbscan::sNN(x, k, search = "dist", sort = TRUE)
expect_equal(nn, nn_d2)
x_na <- x
x_na[c(1,3,5), 1] <- NA
expect_error(dbscan::sNN(x_na, k = 3), regexp = "NA")
res_d1 <- dbscan::sNN(x_na, k = 3, search = "dist")
res_d2 <- dbscan::sNN(dist(x_na), k = 3)
expect_equal(res_d1, res_d2)
x_na[c(1,3,5),] <- NA
expect_error(dbscan::sNN(x_na, k = 3), regexp = "NA")
expect_error(dbscan::sNN(x_na, k = 3, search = "dist"), regexp = "NA")
expect_error(dbscan::sNN(dist(x_na), k = 3), regexp = "NA")
nn10 <- dbscan::sNN(x, k = 10, sort = FALSE)
expect_equal(nn10$sort_shared, FALSE)
expect_error(dbscan::sNN(nn10, k = 11))
nn5 <- dbscan::sNN(nn10, k = 5, sort = TRUE)
nn5_x <- dbscan::sNN(x, k = 5, sort = TRUE)
expect_equal(nn5, nn5_x)
x <- data.frame(x=1:10)
nn <- dbscan::sNN(x, k = 5)
i <- 1
j_ind <- 1
j <- nn$id[i,j_ind]
intersect(c(i, nn$id[i,]), nn$id[j,])
nn$shared[i,j_ind]
ss <- matrix(nrow = nrow(x), ncol = nn$k)
for(i in 1:nrow(x))
for(j_ind in 1:nn$k)
ss[i, j_ind] <- length(intersect(c(i, nn$id[i,]), nn$id[nn$id[i,j_ind],]))
expect_equivalent(nn$shared, ss) |
test_that("errors thrown at block level are entraced", {
f <- function() g()
g <- function() stop("foo")
f()
})
test_that("errors thrown from a quasi-labelled argument are entraced", {
foo <- function() stop("foo")
expect_s3_class(foo(), "foo")
})
test_that("errors thrown from a quasi-labelled argument are entraced (deep case)", {
foo <- function() stop("foo")
f <- function() g()
g <- function() expect_s3_class(foo(), "foo")
expect_s3_class(f(), "foo")
})
test_that("errors thrown from a quasi-labelled argument are entraced (deep deep case)", {
foo <- function() bar()
bar <- function() stop("foobar")
f <- function() g()
g <- function() expect_s3_class(foo(), "foo")
f()
})
test_that("failed expect_error() prints a backtrace", {
f <- function() signaller()
signaller <- function() stop("bar")
expect_error(f(), "foo")
})
test_that("Errors are inspected with `conditionMessage()`", {
rlang::scoped_bindings(
.env = globalenv(),
conditionMessage.foobar = function(...) "dispatched"
)
rlang::abort("Wrong message", "foobar")
})
test_that("also get backtraces for warnings", {
foo <- function() bar()
bar <- function() warning("foobar", call. = FALSE)
foo()
expect_true(TRUE)
})
test_that("deep stacks are trimmed", {
f <- function(x) {
if (x > 0) f(x - 1) else stop("This is deep")
}
f(25)
})
f <- function() g()
g <- function() h()
h <- function() expect_true(FALSE)
f()
test_that("nested expectations get backtraces", {
f()
}) |
renv_renvignore_pattern <- function(path = getwd(), root = path) {
if (is.null(root))
return(NULL)
stopifnot(
renv_path_absolute(path),
renv_path_absolute(root)
)
ignores <- stack()
parent <- path
while (parent != dirname(parent)) {
for (file in c(".renvignore", ".gitignore")) {
candidate <- file.path(parent, file)
if (file.exists(candidate)) {
contents <- readLines(candidate, warn = FALSE)
parsed <- renv_renvignore_parse(contents, parent)
if (length(parsed))
ignores$push(parsed)
break
}
}
if (parent == root)
break
parent <- dirname(parent)
}
patterns <- ignores$data()
include <- unlist(extract(patterns, "include"))
exclude <- unlist(extract(patterns, "exclude"))
include <- c(include, renv_renvignore_pattern_extra("include", root))
exclude <- c(exclude, renv_renvignore_pattern_extra("exclude", root))
exclude <- c("/[.][^/]*/$", exclude)
list(include = include, exclude = exclude)
}
renv_renvignore_parse <- function(contents, prefix = "") {
contents <- grep("^\\s*(?:
if (empty(contents))
return(list())
negate <- substring(contents, 1L, 1L) == "!"
exclude <- contents[!negate]
include <- substring(contents[negate], 2L)
list(
exclude = renv_renvignore_parse_impl(exclude, prefix),
include = renv_renvignore_parse_impl(include, prefix)
)
}
renv_renvignore_parse_impl <- function(entries, prefix = "") {
if (empty(entries))
return(character())
entries <- gsub("\\s+$", "", entries)
noslash <- grep("/", gsub("/*$", "", entries), fixed = TRUE, invert = TRUE)
entries[noslash] <- paste("**", entries[noslash], sep = "/")
entries <- gsub("^/+", "", entries)
entries <- gsub("**/", "\001", entries, fixed = TRUE)
entries <- gsub("/**", "\002", entries, fixed = TRUE)
entries <- gsub("*", "\\E[^/]*\\Q", entries, fixed = TRUE)
entries <- gsub("?", "\\E[^/]\\Q", entries, fixed = TRUE)
entries <- gsub("\001", "\\E(?:.*/)?\\Q", entries, fixed = TRUE)
entries <- gsub("\002", "/\\E.*\\Q", entries, fixed = TRUE)
noslash <- grep("/$", entries, invert = TRUE)
entries[noslash] <- paste0(entries[noslash], "\\E(?:/)?\\Q")
entries <- sprintf("\\Q%s\\E$", entries)
entries <- sprintf("^\\Q%s/\\E%s", prefix, entries)
entries <- gsub("\\Q\\E", "", entries, fixed = TRUE)
entries
}
renv_renvignore_exec <- function(path, root, children) {
if (identical(root, children))
return(FALSE)
patterns <- renv_renvignore_pattern(path, root)
if (empty(patterns) || empty(patterns$exclude))
return(logical(length(children)))
info <- renv_file_info(children)
dirs <- info$isdir %in% TRUE
children[dirs] <- paste0(children[dirs], "/")
excludes <- logical(length = length(children))
for (pattern in patterns$exclude)
if (nzchar(pattern))
excludes <- excludes | grepl(pattern, children, perl = TRUE)
if (length(patterns$include)) {
includes <- logical(length = length(children))
for (pattern in patterns$include)
if (nzchar(pattern))
includes <- includes | grepl(pattern, children, perl = TRUE)
excludes[includes] <- FALSE
}
excludes
}
renv_renvignore_pattern_extra <- function(key, root) {
optname <- paste("renv.renvignore", key, sep = ".")
patterns <- getOption(optname)
if (is.null(patterns))
return(NULL)
asis <- attr(patterns, "asis", exact = TRUE)
if (identical(asis, TRUE))
return(patterns)
root <- attr(patterns, "root", exact = TRUE) %||% root
patterns <- renv_renvignore_parse(patterns, root)
patterns[[key]]
} |
circ.summary <- function(u, rads = FALSE, fast = FALSE, tol = 1e-07, plot = TRUE) {
if ( !rads ) u <- u * pi/180
if (fast) {
mod <- Rfast::vm.mle(u, tol = tol)
res <- list(mesos = mod$param[1], kappa = mod$param[2], loglik = mod$loglik)
} else {
n <- length(u)
C <- sum( cos(u) ) / n
S <- sum( sin(u) )/ n
Rbar <- sqrt( C^2 + S^2 )
if (C > 0) {
mesos <- atan(S/C)
} else mesos <- atan(S/C) + pi
MRL <- Rbar
circv <- 1 - Rbar
circs <- sqrt( -2 * log(Rbar) )
lik <- function(k) k * sum( cos(u - mesos) ) - n * ( log(besselI( k, 0, expon.scaled = TRUE) ) + k )
mod <- optimize(lik, c(0, 50000), maximum = TRUE, tol = tol)
kappa <- mod$maximum
R <- n * Rbar
if (Rbar < 2/3) {
fact <- sqrt(2 * n * ( 2 * R^2 - n * qchisq(0.95, 1) )/ ( R^2 * ( 4 * n - qchisq(0.95, 1)) ) )
ci <- c(mesos - acos(fact), mesos + acos(fact))
} else {
fact <- sqrt( n^2 - (n^2 - R^2) * exp( qchisq(0.95, 1)/n ) )/R
ci <- c(mesos - acos(fact), mesos + acos(fact))
}
if ( !rads ) {
mesos <- mesos * 180/pi
ci <- ci * 180/pi
}
if ( plot ) {
r <- seq(0, 2 * pi, by = 0.01)
plot(cos(r), sin(r), type = "l", xlab = "Cosinus", ylab = "Sinus", cex.lab = 1.2)
xx <- seq(-1, 1, by = 0.1)
yy <- seq(-1, 1, by = 0.1)
ta <- numeric(length(xx))
lines(ta, xx, type = "l", lty = 2)
lines(yy, ta, lty = 2)
points(cos(u), sin(u))
}
res <- list( mesos = mesos, confint = ci, kappa = kappa, MRL = MRL, circvariance = circv, circstd = circs, loglik = mod$objective - n * log(2 * pi) )
}
res
} |
context("Skeletor with no configuration")
options(skeletor.name=NULL, skeletor.email=NULL, skeletor.github=NULL)
public({
tmpd <- tempdir()
pkgdir <- tempfile(tmpdir="")
pkgdir <- substr(pkgdir, 2, nchar(pkgdir))
dest <- file.path(tmpd, pkgdir)
test_that("Creating a package skeleton", {
skeletor("testskeletor", dest)
expect_dir_exists(dest)
})
test_that("The right dirs exist", {
expect_dir_exists(file.path(dest, "tests"))
expect_dir_exists(file.path(dest, "man"))
expect_dir_exists(file.path(dest, "vignettes"))
})
test_that("The right files exist", {
expect_file_exists(file.path(dest, "DESCRIPTION"))
expect_file_exists(file.path(dest, ".Rbuildignore"))
expect_file_exists(file.path(dest, "Makefile"))
expect_file_exists(file.path(dest, ".gitignore"))
expect_file_exists(file.path(dest, "R", "testskeletor.R"))
})
desc <- readLines(file.path(dest, "DESCRIPTION"))
tests <- readLines(file.path(dest, "tests", "testthat.R"))
git <- readLines(file.path(dest, ".gitignore"))
lisc <- readLines(file.path(dest, "LICENSE"))
onattach <- readLines(file.path(dest, "R", "testskeletor.R"))
test_that("The package name appears in the contents", {
expect_identical(desc[1], "Package: testskeletor")
expect_identical(tests[2], 'test_check("testskeletor")')
expect_identical(git[4], 'testskeletor*.tar.gz')
})
test_that("Today's date is set in the DESCRIPTION", {
expect_identical(desc[11], paste("Date:", Sys.Date()))
})
test_that("skeletor.name is empty, so it doesn't get overwritten", {
expect_identical(lisc[2], "COPYRIGHT HOLDER: yourname")
expect_true("Author: yourname [aut, cre]" %in% desc)
})
test_that("skeletor.github is empty, so it doesn't get overwritten", {
expect_true("URL: https://github.com/yourgithub/testskeletor" %in% desc)
})
test_that("skeletor.email is empty, so it doesn't get overwritten", {
expect_true("Maintainer: yourname <[email protected]>" %in% desc)
})
test_that("The .onAttach function in the R file points to testskeletor", {
expect_true('.onAttach <- function (lib, pkgname="testskeletor") {' %in% onattach)
})
if (!no.check) {
setwd(tmpd)
test_that("The skeleton package can be built", {
Rcmd(paste("build", pkgdir))
expect_file_exists("testskeletor_0.1.0.tar.gz")
})
test_that("The built package passes R CMD CHECK", {
skip_on_appveyor()
skip_on_cran()
status <- Rcmd("check testskeletor_0.1.0.tar.gz")
expect_equal(status, 0)
})
}
}) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.