#' AWS credentials
#'
#' importFrom paws dynamodb
#'
#' @export
#'
pawsCreds <-function(){
dynamodb <- dynamodb()
s3 <- s3()
Sys.setenv("AWS_ACCESS_KEY_ID" = "AKIATDV6373PZVKRDV6Q",
"AWS_SECRET_ACCESS_KEY" = "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",
"AWS_DEFAULT_REGION" = "us-east-2")
svc <<- s3(
config = list(
credentials = list(
creds = list(
access_key_id = "AKIATDV6373PZVKRDV6Q",
secret_access_key = "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"
),
profile = "public_shiny"
),
endpoint = "https://dynamodb.us-east-2.amazonaws.com",
region = "us-east-2"
)
)
}
#' Reading from S3 bucket
#'
#' importFrom paws s3
#'
#' @export
#'
loadFile <- function(objName, fileName){
s3 <- s3()
pawsCreds()
svc <- s3(
config = list(
credentials = list(
creds = list(
access_key_id = "AKIATDV6373PZVKRDV6Q",
secret_access_key = "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"
),
profile = "public_shiny"
),
endpoint = "https://s3.us-east-2.amazonaws.com",
region = "us-east-2"
)
)
fileName <- "practiceGAreport.rds"
results <- svc$download_file(Bucket = "public-judgeresearch", Key = fileName, Filename = fileName)
objGlobal <- readRDS(fileName2)
assign(objName, objGlobal, envir=globalenv())
file.remove(fileName2)
}
#' Downloads and Sources R script in S3 bucket
#'
#' importFrom paws s3
#'
#' @export
#'
sourceFile <- function(fileName){
s3 <- s3()
pawsCreds()
svc <- s3(
config = list(
credentials = list(
creds = list(
access_key_id = "AKIATDV6373PZVKRDV6Q",
secret_access_key = "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"
),
profile = "public_shiny"
),
endpoint = "https://s3.us-east-2.amazonaws.com",
region = "us-east-2"
)
)
fileName2 <- fileName
results <- svc$download_file(Bucket = "public-judgeresearch", Key = fileName, Filename = fileName)
objGlobal <- source(fileName)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.