# NOT RUN {
x <- rray(c(1, 1, 2, 2), c(2, 2))
x <- rray_set_row_names(x, c("r1", "r2"))
x <- rray_set_col_names(x, c("c1", "c2"))
# Are there duplicates along the rows?
rray_duplicate_any(x, 1L)
# Are there duplicates along the columns?
rray_duplicate_any(x, 2L)
# Create a 3d version of x
# where the columns are not unique
y <- rray_expand(x, 1)
# Along the rows, all the values are unique...
rray_duplicate_any(y, 1L)
# ...but along the columns there are duplicates
rray_duplicate_any(y, 2L)
# ---------------------------------------------------------------------------
z <- rray(c(1, 1, 2, 3, 1, 4, 5, 6), c(2, 2, 2))
# rray_duplicate_detect() looks for any
# duplicates along the axes of interest
# and returns `TRUE` wherever a duplicate is found
# (including the first location)
rray_duplicate_detect(z, 1)
# Positions 1 and 5 are the same!
rray_duplicate_detect(z, 3)
# ---------------------------------------------------------------------------
# rray_duplicate_id() returns the location
# of the first occurance along each axis.
# Compare to rray_duplicate_detect()!
rray_duplicate_detect(z, 1)
rray_duplicate_id(z, 1)
# }
Run the code above in your browser using DataLab