208
208
# ' head(select(tmp, array_contains(tmp$v1, 21), size(tmp$v1)))
209
209
# ' head(select(tmp, array_max(tmp$v1), array_min(tmp$v1)))
210
210
# ' head(select(tmp, array_position(tmp$v1, 21), array_sort(tmp$v1)))
211
- # ' head(select(tmp, flatten(tmp$v1)))
211
+ # ' head(select(tmp, flatten(tmp$v1), reverse(tmp$v1) ))
212
212
# ' tmp2 <- mutate(tmp, v2 = explode(tmp$v1))
213
213
# ' head(tmp2)
214
214
# ' head(select(tmp, posexplode(tmp$v1)))
@@ -218,7 +218,10 @@ NULL
218
218
# ' tmp3 <- mutate(df, v3 = create_map(df$model, df$cyl))
219
219
# ' head(select(tmp3, map_keys(tmp3$v3)))
220
220
# ' head(select(tmp3, map_values(tmp3$v3)))
221
- # ' head(select(tmp3, element_at(tmp3$v3, "Valiant")))}
221
+ # ' head(select(tmp3, element_at(tmp3$v3, "Valiant")))
222
+ # ' tmp4 <- mutate(df, v4 = create_array(df$mpg, df$cyl), v5 = create_array(df$hp))
223
+ # ' head(select(tmp4, concat(tmp4$v4, tmp4$v5)))
224
+ # ' head(select(tmp, concat(df$mpg, df$cyl, df$hp)))}
222
225
NULL
223
226
224
227
# ' Window functions for Column operations
@@ -1260,9 +1263,9 @@ setMethod("quarter",
1260
1263
})
1261
1264
1262
1265
# ' @details
1263
- # ' \code{reverse}: Reverses the string column and returns it as a new string column .
1266
+ # ' \code{reverse}: Returns a reversed string or an array with reverse order of elements .
1264
1267
# '
1265
- # ' @rdname column_string_functions
1268
+ # ' @rdname column_collection_functions
1266
1269
# ' @aliases reverse reverse,Column-method
1267
1270
# ' @note reverse since 1.5.0
1268
1271
setMethod ("reverse ",
@@ -2055,20 +2058,10 @@ setMethod("countDistinct",
2055
2058
2056
2059
# ' @details
2057
2060
# ' \code{concat}: Concatenates multiple input columns together into a single column.
2058
- # ' If all inputs are binary, concat returns an output as binary. Otherwise, it returns as string .
2061
+ # ' The function works with strings, binary and compatible array columns .
2059
2062
# '
2060
- # ' @rdname column_string_functions
2063
+ # ' @rdname column_collection_functions
2061
2064
# ' @aliases concat concat,Column-method
2062
- # ' @examples
2063
- # '
2064
- # ' \dontrun{
2065
- # ' # concatenate strings
2066
- # ' tmp <- mutate(df, s1 = concat(df$Class, df$Sex),
2067
- # ' s2 = concat(df$Class, df$Sex, df$Age),
2068
- # ' s3 = concat(df$Class, df$Sex, df$Age, df$Class),
2069
- # ' s4 = concat_ws("_", df$Class, df$Sex),
2070
- # ' s5 = concat_ws("+", df$Class, df$Sex, df$Age, df$Survived))
2071
- # ' head(tmp)}
2072
2065
# ' @note concat since 1.5.0
2073
2066
setMethod ("concat ",
2074
2067
signature(x = " Column" ),
@@ -2409,6 +2402,13 @@ setMethod("shiftRightUnsigned", signature(y = "Column", x = "numeric"),
2409
2402
# ' @param sep separator to use.
2410
2403
# ' @rdname column_string_functions
2411
2404
# ' @aliases concat_ws concat_ws,character,Column-method
2405
+ # ' @examples
2406
+ # '
2407
+ # ' \dontrun{
2408
+ # ' # concatenate strings
2409
+ # ' tmp <- mutate(df, s1 = concat_ws("_", df$Class, df$Sex),
2410
+ # ' s2 = concat_ws("+", df$Class, df$Sex, df$Age, df$Survived))
2411
+ # ' head(tmp)}
2412
2412
# ' @note concat_ws since 1.5.0
2413
2413
setMethod ("concat_ws ", signature(sep = "character", x = "Column"),
2414
2414
function (sep , x , ... ) {
@@ -3063,7 +3063,8 @@ setMethod("array_sort",
3063
3063
})
3064
3064
3065
3065
# ' @details
3066
- # ' \code{flatten}: Transforms an array of arrays into a single array.
3066
+ # ' \code{flatten}: Creates a single array from an array of arrays.
3067
+ # ' If a structure of nested arrays is deeper than two levels, only one level of nesting is removed.
3067
3068
# '
3068
3069
# ' @rdname column_collection_functions
3069
3070
# ' @aliases flatten flatten,Column-method
0 commit comments