New function to initialize d4storagehub4R.

This commit is contained in:
Andrea Dell'Amico 2023-03-23 12:43:44 +01:00
parent 4f21089103
commit 362007112b
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
1 changed files with 12 additions and 7 deletions

View File

@ -17,6 +17,10 @@ print(paste(""))
print(paste("You can also access, read and write any folder of your workspace"))
print(paste("by loading - and using - the package 'd4storagehub4R'"))
print(paste("developed by E. Blondel, with source code available at https://github.com/eblondel/d4storagehub4R"))
print(paste("To create the manager to interact with the Workspace, use the R code: storagehub = initStoragehubManager()"))
print(paste("For more info about methods available to interact with workspace,"))
print(paste("consult the documentation at ?d4storagehub4R::StoragehubManager"))
print(paste(""))
print(paste("It is recommended to save any worth maintaining file into the workspace to persist it."))
print(paste("The persistence of files stored elsewhere is not guaranteed."))
print(paste("***********************************************"))
@ -37,11 +41,12 @@ options(repos = c(CRAN = 'https://packagemanager.rstudio.com/cran/__linux__/foca
# https://docs.rstudio.com/rspm/admin/serving-binaries/#binaries-r-configuration-linux
options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])))
Sys.setlocale(category = "LC_ALL", locale = "en_US.UTF-8")
require(d4storagehub4R)
# more information at ?StoragehubManager
# print(paste(""))
# print(paste("Run the following code to initialize the StoragehubManager:"))
# print(paste('WORKSPACE = d4storagehub4R::StoragehubManager$new(token_type = "jwt", token = Sys.getenv("D4SCIENCE_TOKEN"))'))
# print(paste(""))
print(paste(""))
initStoragehubManager = function(){
require(d4storagehub4R)
storagehub <- d4storagehub4R::StoragehubManager$new(
token_type = "jwt", token = Sys.getenv("D4SCIENCE_TOKEN")
)
return(storagehub)
}
print(paste("Using Locale Encoding:",Sys.setlocale("LC_CTYPE","en_US.UTF-8")));