GithubHelp home page GithubHelp logo

agaveplatform / r-sdk Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 691 KB

Official R client SDK to the Agave Platform -- EARLY ALPHA

Home Page: https://agaveapi.co/

License: Other

R 97.58% Shell 0.40% HTML 1.80% Dockerfile 0.21%

r-sdk's Issues

Could not install from NAMESPACE error

Tried to install the package via clone repo change working directory in R to repo directory and follow

library(devtools)
install(".")

Generated the following error:

> setwd("~/Stapleton_Lab/agave-rlang-sdk")
> install(".")
Installing swagger
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/Users/d3r3zz3d/Stapleton_Lab/agave-rlang-sdk'  \
  --library='/Library/Frameworks/R.framework/Versions/3.4/Resources/library' --install-tests 

* installing *source* package ‘swagger’ ...
ERROR: a 'NAMESPACE' file is required
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/swagger’
 Show Traceback
 
 Rerun with Debug
 Error: Command failed (1) 

Opened terminal and cd to repo directory. Issued command:
echo 'exportPattern( "." )' > NAMESPACE
and then reattempted install(".") with success.

Coding style recommendations

Using the SDK a bit, I'm wondering about what people prefer with respect to coding style. I see a few common recommendations showing up in Google searches:

The current syntax is akin to Google's style guide, but feels a little non-idiomatic for a scripting language. Would it be more helpful for existing users if the R SDK mirrored the agavepy syntax, or would it be more helpful to adhere to the existing structure which more closely reflects the Java, PHP, and AngularJS syntax?

Current/Google

library("rAgave")
api <- Agave$new()
system <- api$systems$getDetails(id = "example.com")
print(system$storage$rootDir)

tidyverse

library("r_agave")
api <- agave$new()
system <- api$systems$get_details(id = "example.com")
print(system$storage$root_dir)

We might also consider use S3 classes instead of S6 classes, which would allow for a pythonic dot notation that reads a bit more like core R

library("agave")
api <- new_agave()
system <- api.systems.get_details(id = "example.com")

Cannot Instantiate using the Example

Running through the example using the Docker environment and receiving an error when running the
ag <-Agave$new command.
The console output is below. In the instructions you might mention to the user to change their working directory to the examples folder and the install("..") to install("../rAgave")

`R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Error in loadNamespace(name) : there is no package called ‘rmarkdown’
31 Jan 2018 17:34:20 [rsession-rstudio] ERROR r error 4 (R code execution error) [errormsg=Error in loadNamespace(name) : there is no package called ‘rmarkdown’
]; OCCURRED AT: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::{anonymous}::EvalType) /home/ubuntu/rstudio/src/cpp/r/RExec.cpp:159; LOGGED FROM: void rstudio::session::modules::rmarkdown:📓:{anonymous}::onDocAdded(const string&) /home/ubuntu/rstudio/src/cpp/session/modules/rmarkdown/NotebookCache.cpp:341

library("rAgave")

For security, we'll pull our variables from the environment rather than enter them directly.

myCreds <- Sys.getenv( c("AGAVE_USERNAME", "AGAVE_PASSWORD", "AGAVE_TENANT", "AGAVE_BASE_URL"), names = TRUE )

Prompt for them if not present, and store them in the environment in case we rerun this later.

if (is.null(myCreds[["AGAVE_USERNAME"]]) || nchar(myCreds[["AGAVE_USERNAME"]]) == 0) {

  • myCreds[["AGAVE_USERNAME"]] <- readline("Agave username:")
  • Sys.setenv(AGAVE_USERNAME = myCreds[["AGAVE_USERNAME"]])
  • }
    Agave username:dhbrand

if (is.null(myCreds[["AGAVE_PASSWORD"]]) || nchar(myCreds[["AGAVE_PASSWORD"]]) == 0) {

  • myCreds[["AGAVE_PASSWORD"]] <- readline("Agave password:")
  • Sys.setenv(AGAVE_PASSWORD = myCreds[["AGAVE_PASSWORD"]])
  • }
    Agave password:Engaged1001

if (is.null(myCreds[["AGAVE_BASE_URL"]]) || nchar(myCreds[["AGAVE_BASE_URL"]]) == 0) {

#detach("package:futile.logger", unload=TRUE)
#detach("package:rAgave", unload=TRUE)
install("..")
Error: Could not find package root.
getwd()
[1] "/home/rstudio"
setwd("~/examples")
library("rAgave")

For security, we'll pull our variables from the environment rather than enter them directly.

myCreds <- Sys.getenv( c("AGAVE_USERNAME", "AGAVE_PASSWORD", "AGAVE_TENANT", "AGAVE_BASE_URL"), names = TRUE )
#detach("package:futile.logger", unload=TRUE)
#detach("package:rAgave", unload=TRUE)
install("..")
Error: Could not find package root.
getwd()
[1] "/home/rstudio/examples"
#detach("package:futile.logger", unload=TRUE)
#detach("package:rAgave", unload=TRUE)
install("../rAgave")
Installing rAgave
'/usr/local/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL
'/home/rstudio/rAgave' --library='/usr/local/lib/R/site-library' --install-tests

  • installing source package ‘rAgave’ ...
    ** R
    ** preparing package for lazy loading
    ** help
    No man pages found in package ‘rAgave’
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (rAgave)
    Reloading installed rAgave

ag <-Agave$new( baseUrl = myCreds[["AGAVE_BASE_URL"]],

  •             username = myCreds[["AGAVE_USERNAME"]], 
    
  •             password = myCreds[["AGAVE_PASSWORD"]])
    

cannot open file 'agave.log': Permission deniedError in file(file, ifelse(append, "a", "w")) :
cannot open the connection`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.