Merge branch 'master' of git.curoverse.com:arvados into 11876-r-sdk
[arvados.git] / sdk / R / README
1 R SDK for Arvados
2
3 Examples of usage:
4
5 --------------------------------------------------------------------------------------------------------------------------------
6
7 #Initialize API:
8
9 arv <- Arvados$new("insert_token", "insert_host_name")
10
11 --------------------------------------------------------------------------------------------------------------------------------
12
13 #Get collection:
14
15 arv$getCollection("uuid")
16
17 --------------------------------------------------------------------------------------------------------------------------------
18
19 #List collections:
20
21 collectionList <- arv$listCollections(list("uuid", "=" "aaaaa-bbbbb-ccccccccccccccc"), limit = 10, offset = 2)
22
23 --------------------------------------------------------------------------------------------------------------------------------
24
25 #Delete collection:
26
27 deletedCollection <- arv$deleteCollection("uuid")
28
29 --------------------------------------------------------------------------------------------------------------------------------
30
31 #Update collection:
32
33 updatedCollection <- arv$updateCollection("uuid", list(collection = list(name = "new_name", description = "new_desciption")))
34
35 --------------------------------------------------------------------------------------------------------------------------------
36
37 #Create collection:
38
39 updatedCollection <- arv$createCollection("uuid", list(collection = list(name = "new_name", description = "new_desciption")))
40
41 --------------------------------------------------------------------------------------------------------------------------------
42
43 --------------------------------------------------------------------------------------------------------------------------------
44
45 #Collection manipulation:
46
47 --------------------------------------------------------------------------------------------------------------------------------
48
49 --------------------------------------------------------------------------------------------------------------------------------
50
51 #Create collection object:
52
53 arv <- Arvados$new("insert_token", "insert_host_name")
54 collection <- Collection$new(arv, "uuid")
55
56 --------------------------------------------------------------------------------------------------------------------------------
57
58 #Print content of the collection (directory/folder tree structure)
59
60 collection$printFileContent()
61
62 --------------------------------------------------------------------------------------------------------------------------------
63
64 #Get file/folder content as character vector
65
66 collection$getFileContent()
67
68 --------------------------------------------------------------------------------------------------------------------------------
69
70 #This will return ArvadosFile or Subcollection from internal tree-like structure.
71
72 arvadosFile <- collection$get("location/to/my/file.cpp")
73
74 #or
75
76 arvadosSubcollection <- collection.get("location/to/my/directory/")
77
78 --------------------------------------------------------------------------------------------------------------------------------
79
80 #Read whole file or just a portion of it.
81
82 fileContent <- arvadosFile$read(offset = 1024, length = 512)
83
84 --------------------------------------------------------------------------------------------------------------------------------
85
86 #Get ArvadosFile or Subcollection size
87
88 size <- arvadosFile$getSizeInBytes()
89 size <- arvadosSubcollection$getSizeInBytes()
90
91 --------------------------------------------------------------------------------------------------------------------------------