Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

In the user tutorial and in the code examples in the documentation of each datashield function, logging in to VMs or remote servers can be accomplished using the data() function to access the required login details. For example:

> library(dsBaseClient)
> data(logindata)
> logindata

The logindata object is available because it is part of the (in this case) dsBaseClient package.

In the source code, it is stored as a .rda file in the data/ folder of the package. See the dsBaseClient code on GitHub.

Creating new data objects to be bundled with a client package is a three step process:

1. Create the object in R

For example, construct a dataframe containing datashield login details:

> server <- c("study0", "study1")
> url <- c("192.168.56.100:8080", "192.168.56.101:8080")
> user <- "administrator"
> password <- "password"
> table <- c("DASIM.DASIM", "DASIM.DASIM")
> DASIM_logindata <- data.frame(server,url,user,password,table)

2. Save the object as a .rda file

> save(DASIM_logindata, file='DASIM_logindata.rda', ascii=TRUE)

The option ascii=TRUE creates a text file, rather than a binary file.

3. Add to the client package

Move the .rda file into dsBaseClient/data, add and commit the file, then push to GitHub.

Note: roxygen can be used to document the data object by including a .R file in the package R/ folder.

See for example, the diamonds dataset documentation within the ggplot2 package.

 

  • No labels