Difference between revisions of "Workspace Interaction From R"
From Gcube Wiki
(→Functions) |
(→Functions) |
||
Line 11: | Line 11: | ||
= Functions = | = Functions = | ||
− | * INITIAL STEP: Import the [svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/RConfiguration/RD4SFunctions/workspace_interaction.r D4Science interaction functions R container script]. | + | * INITIAL STEP: Import the [svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/RConfiguration/RD4SFunctions/workspace_interaction.r D4Science interaction functions R container script]. '''This step is not necessary when using the RStudio instance on one of the Web portals.''' |
− | '''This step is not necessary when using the RStudio instance on one of the Web portals.''' | + | |
<source lang="java"> | <source lang="java"> | ||
− | #SETTING USERNAME AND TOKEN - NOT NEEDED | + | #SETTING USERNAME AND TOKEN - NOT NEEDED WHEN USING RSTUDIO ON THE PORTAL |
username<<-"gianpaolo.coro" | username<<-"gianpaolo.coro" | ||
token<<-"..." #YOUR TOKEN FOR A VRE | token<<-"..." #YOUR TOKEN FOR A VRE |
Revision as of 16:46, 11 November 2016
Overview
This page reports examples to interact with the online Workspace (WS) from R.
Key features
- interaction with R
- saving files and folders on the WS
- downloading files and folders from the WS
Functions
- INITIAL STEP: Import the [svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/RConfiguration/RD4SFunctions/workspace_interaction.r D4Science interaction functions R container script]. This step is not necessary when using the RStudio instance on one of the Web portals.
#SETTING USERNAME AND TOKEN - NOT NEEDED WHEN USING RSTUDIO ON THE PORTAL username<<-"gianpaolo.coro" token<<-"..." #YOUR TOKEN FOR A VRE #LISTING a<-listHomeWS() #GET THE LIST OF FOLDERS IN THE WS ROOT b<-listWS("/Home/gianpaolo.coro/Workspace/TestSAI/") #GET THE LIST OF FILES AND FOLDERS IN ONE SUB-FOLDER #DOWNLOADING remoteFile<-"/Home/gianpaolo.coro/Workspace/DataMiner/Computations/BIONYM_ID_ed8d0215-e55b-41cc-bdd8-30a8a159ae62/BIONYM_ID_ed8d0215-e55b-41cc-bdd8-30a8a159ae62.xml" #REMOTE FILE NAME TO DOWNLOAD downloadFileWS(remoteFile) #DOWNLOAD THE FILE LOCALLY folder<-"/Home/gianpaolo.coro/Workspace/TestSAI" #REMOTE FOLDER TO DOWNLOAD downloadFolderWS(folder) #DOWNLOAD THE FOLDER CONTENT LOCALLY #UPLOADING wsfolder<-"/Home/gianpaolo.coro/Workspace/TestUploads" #REMOTE DESTINATION FOLDER file="userconfig.csv" #LOCAL FILE TO UPLOAD overwrite<-T #CHOOSE IF THE FILE SHOULD BE OVERWRITTEN q<-uploadWS(wsfolder,file,overwrite) #UPLOAD THE FILE TO THE WS #UPLOADING THE COMPLETE R WORKSPACE ONTO THE E-INFRA WS uploadAllWS(wsfolder,overwrite)