Merge branch 'master' of git.curoverse.com:arvados into 11876-r-sdk
[arvados.git] / sdk / R / README
index 7f984fe6f9f8a0b9262db3def73cdd0ab80259eb..8a0c31dce6131ec30dc8f1d66fbc00b7b4531aa7 100644 (file)
@@ -16,7 +16,7 @@ If needed, you may have to install the supporting packages first. On Linux, thes
 
 2. Install the ArvardosR package
 
-    > install.packages('/path/to/ArvadosR_0.0.1.tar.gz', repos = NULL, type="source", dependencies = TRUE)
+    > install.packages('/path/to/ArvadosR_0.0.2.tar.gz', repos = NULL, type="source", dependencies = TRUE)
 
 
 EXAMPLES OF USAGE
@@ -43,6 +43,10 @@ collectionList <- arv$listCollections(list(list("name", "like", "Test%")), limit
 collectionList$items_available # count of total number of items (may be more than returned due to paging)
 collectionList$items # items which match the filter criteria
 
+#Next example will list all collections even when the number of items is greater than maximum API limit
+
+collectionList <- arv$listAllCollections(list(list("name", "like", "Test%")))
+
 --------------------------------------------------------------------------------------------------------------------------------
 
 #Delete a collection:
@@ -53,7 +57,7 @@ deletedCollection <- arv$deleteCollection("uuid")
 
 #Update a collection's metadata:
 
-updatedCollection <- arv$updateCollection("uuid", list(name = "My new name", description = "a brand new description"))
+updatedCollection <- arv$updateCollection("uuid", list(name = "New name", description = "New description"))
 
 --------------------------------------------------------------------------------------------------------------------------------
 
@@ -90,13 +94,13 @@ arvadosSubcollection <- collection$get("location/to/my/directory/")
 
 #Read a table
 
-arvadosFile <- collection$get("myinput.txt")
+arvadosFile   <- collection$get("myinput.txt")
 arvConnection <- arvadosFile$connection("r")
-mytable <- read.table(arvConnection)
+mytable       <- read.table(arvConnection)
 
 #Write a table
 
-arvadosFile <- collection$create("myoutput.txt")
+arvadosFile   <- collection$create("myoutput.txt")
 arvConnection <- arvadosFile$connection("w")
 write.table(mytable, arvConnection)
 arvadosFile$flush()
@@ -132,7 +136,7 @@ fileList <- collection$create(c("main.cpp", lib.dll), "cpp/src/")
 #Add existing ArvadosFile or Subcollection to a collection
 
 folder <- Subcollection$new("src")
-file <- ArvadosFile$new("main.cpp")
+file   <- ArvadosFile$new("main.cpp")
 folder$add(file)
 
 collection$add(folder, "cpp")
@@ -152,39 +156,41 @@ arvadosFile$write("This is new file content")
 
 #Delete file from a collection
 
-file <- collection$get("location/to/my/file.cpp")
-
-file$removeFromCollection()
+collection$remove("location/to/my/file.cpp")
 
-#Or
-
-collection$remove(file)
-
-#Both examples will remove file "file.cpp" from a collection
+#You can remove both Subcollection and ArvadosFile
 #If subcollection contains more files or folders they will be removed recursively.
 
 #You can also remove multiple files
 
 collection$remove(c("path/to/my/file.cpp", "path/to/other/file.cpp"))
 
+#Delete file or folder from a Subcollection
+
+subcollection <- collection$get("mySubcollection/")
+subcollection$remove("fileInsideSubcollection.exe")
+subcollection$remove("folderInsideSubcollection/")
+
 --------------------------------------------------------------------------------------------------------------------------------
 
 #Move file or folder inside collection
 
-file <- collection$get("location/to/my/file.cpp")
+#Directley from collection
 
-file$move("destination/file.cpp")
+collection$move("folder/file.cpp", "file.cpp")
 
-#Or subcollections
+#Or from file
 
-subcollection <- collection$get("location/to/folder")
+file <- collection$get("location/to/my/file.cpp")
+file$move("newDestination/file.cpp")
 
-subcollection$move("destination/folder")
+#Or from subcollection
 
-#Make sure to include folder name in destination
-#For example
-#file$move("destination/") will not work
+subcollection <- collection$get("location/to/folder")
+subcollection$move("newDestination/folder")
 
+#Make sure to include new file name in destination
+#In second example file$move("newDestination/") will not work
 
 --------------------------------------------------------------------------------------------------------------------------------
 WORKING WITH ARVADOS PROJECTS
@@ -201,6 +207,10 @@ arv$getProject("uuid")
 projects <- arv$listProjects(list(list("owner_uuid", "=", "aaaaa-j7d0g-ccccccccccccccc"))) # list subprojects of a project
 arv$listProjects(list(list("name","like","Example%"))) # list projects which have names beginning with Example
 
+#Next example will list all projects even when the number of items is greater than maximum API limit
+
+collectionList <- arv$listAllProjects(list(list("name","like","Example%")))
+
 --------------------------------------------------------------------------------------------------------------------------------
 
 #Delete a project: