Hi!
I was looking to use grouped arrays within TileDB R API, but I seem to have hit a wall . Here is a reproducible example below:
library(tiledb)
Data to store
data_1 ← list(a = c(1:3), b = c(“A”, “B”, “C”))
data_2 ← list(a = c(4:6), b = c(“D”, “E”, “F”))URIs
uri_1 ← paste0(getwd(), “/”, “array_1”)
if(tiledb_vfs_is_dir(uri_1)) {tiledb_vfs_remove_dir(uri_1)}
uri_2 ← paste0(getwd(), “/”, “array_2”)
if(tiledb_vfs_is_dir(uri_2)) {tiledb_vfs_remove_dir(uri_2)}Define the TileDB array
dim ← tiledb_dim(name = ‘dimension’,
domain = c(1L, 3L),
tile = 1L,
type = “INT32”)
attr_a ← tiledb_attr(name = “a”, type = “INT32”, nullable = TRUE)
attr_b ← tiledb_attr(name = “b”, type = “CHAR”, nullable = TRUE, ncells = NA)
dom ← tiledb_domain(dims = c(dim))
schema ← tiledb_array_schema(domain = dom,
attrs = c(attr_a, attr_b),
sparse = FALSE)
tiledb_array_create(uri_1, schema)
tiledb_array_create(uri_2, schema)Write data
write_array ← tiledb_array(uri = uri_1)
write_array ← data.frame(data_1, row.names = c(1L:3L))
write_array ← tiledb_array(uri = uri_2)
write_array ← data.frame(data_2, row.names = c(1L:3L))Group arrays
uri_grp = paste0(getwd(), “/”, “group”)
if(tiledb_vfs_is_dir(uri_grp)) {tiledb_vfs_remove_dir(uri_grp)}tiledb_group_create(uri = uri_grp)
group ← tiledb_group(uri = uri_grp,
type = c(“WRITE”))
tiledb_group_add_member(grp = group,
uri = uri_1,
relative = FALSE,
name = “array_1”)
tiledb_group_add_member(grp = group,
uri = uri_2,
relative = FALSE,
name = “array_1”)Check if groups have been populated:
group
tiledb_group_member_count(tiledb_group(uri = uri_grp, type = “READ”))
The group I have created do not contain anything except a name, and it seems the tiled_group_add_member command does not do anything.
group
group GROUP
tiledb_object_type(uri = uri_grp)
[1] “GROUP”
tiledb_group_member_count(tiledb_group(uri = uri_grp, type = “READ”))
[1] 0
Would anyone have else encountered the same issue?
J.