[ARVADOS] created: 2.1.0-7-g09a93fb2f
Git user
git at public.arvados.org
Thu Oct 15 16:08:05 UTC 2020
at 09a93fb2fb82e886a602d8e34e062e8460b97c7a (commit)
commit 09a93fb2fb82e886a602d8e34e062e8460b97c7a
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Thu Oct 15 12:07:33 2020 -0400
16998: Collection$create returns (vector of) ArvadosFile object
Update documentation.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/sdk/R/R/Collection.R b/sdk/R/R/Collection.R
index 144083654..9ed758c0a 100644
--- a/sdk/R/R/Collection.R
+++ b/sdk/R/R/Collection.R
@@ -116,9 +116,8 @@ Collection <- R6::R6Class(
private$REST$create(file, self$uuid)
newTreeBranch$setCollection(self)
+ newTreeBranch
})
-
- "Created"
}
else
{
diff --git a/sdk/R/README.Rmd b/sdk/R/README.Rmd
index 63bf55373..ee46ed28d 100644
--- a/sdk/R/README.Rmd
+++ b/sdk/R/README.Rmd
@@ -71,6 +71,12 @@ arv$setNumRetries(5)
collection <- arv$collections.get("uuid")
```
+Be aware that the result from `collections.get` is _not_ a
+`Collection` class. The object returned from this method lets you
+access collection fields like "name" and "description". The
+`Collection` class lets you access the files in the collection for
+reading and writing, and is described in the next section.
+
* List collections:
```{r}
@@ -106,7 +112,7 @@ deletedCollection <- arv$collections.delete("uuid")
updatedCollection <- arv$collections.update(list(name = "New name", description = "New description"), "uuid")
```
-* Create collection:
+* Create a new collection:
```{r}
newCollection <- arv$collections.create(list(name = "Example", description = "This is a test collection"))
@@ -115,7 +121,7 @@ newCollection <- arv$collections.create(list(name = "Example", description = "Th
#### Manipulating collection content
-* Create collection object:
+* Initialize a collection object:
```{r}
collection <- Collection$new(arv, "uuid")
@@ -150,13 +156,13 @@ mytable <- read.table(arvConnection)
* Write a table:
```{r}
-arvadosFile <- collection$create("myoutput.txt")
+arvadosFile <- collection$create("myoutput.txt")[[1]]
arvConnection <- arvadosFile$connection("w")
write.table(mytable, arvConnection)
arvadosFile$flush()
```
-* Write to existing file (override current content of the file):
+* Write to existing file (overwrites current content of the file):
```{r}
arvadosFile <- collection$get("location/to/my/file.cpp")
@@ -192,7 +198,7 @@ collection$create(files)
Example:
```{r}
-mainFile <- collection$create("cpp/src/main.cpp")
+mainFile <- collection$create("cpp/src/main.cpp")[[1]]
fileList <- collection$create(c("cpp/src/main.cpp", "cpp/src/util.h"))
```
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list