@@ -150,6 +150,27 @@ NULL
150150# ' df <- createDataFrame(cbind(model = rownames(mtcars), mtcars))}
151151NULL
152152
153+ # ' Miscellaneous functions for Column operations
154+ # '
155+ # ' Miscellaneous functions defined for \code{Column}.
156+ # '
157+ # ' @param x Column to compute on. In \code{sha2}, it is one of 224, 256, 384, or 512.
158+ # ' @param y Column to compute on.
159+ # ' @param ... additional Columns.
160+ # ' @name column_misc_functions
161+ # ' @rdname column_misc_functions
162+ # ' @family misc functions
163+ # ' @examples
164+ # ' \dontrun{
165+ # ' # Dataframe used throughout this doc
166+ # ' df <- createDataFrame(cbind(model = rownames(mtcars), mtcars)[, 1:2])
167+ # ' tmp <- mutate(df, v1 = crc32(df$model), v2 = hash(df$model),
168+ # ' v3 = hash(df$model, df$mpg), v4 = md5(df$model),
169+ # ' v5 = sha1(df$model), v6 = sha2(df$model, 256))
170+ # ' head(tmp)
171+ # ' }
172+ NULL
173+
153174# ' @details
154175# ' \code{lit}: A new Column is created to represent the literal value.
155176# ' If the parameter is a Column, it is returned unchanged.
@@ -569,19 +590,13 @@ setMethod("count",
569590 column(jc )
570591 })
571592
572- # ' crc32
573- # '
574- # ' Calculates the cyclic redundancy check value (CRC32) of a binary column and
575- # ' returns the value as a bigint.
576- # '
577- # ' @param x Column to compute on.
593+ # ' @details
594+ # ' \code{crc32}: Calculates the cyclic redundancy check value (CRC32) of a binary column
595+ # ' and returns the value as a bigint.
578596# '
579- # ' @rdname crc32
580- # ' @name crc32
581- # ' @family misc functions
582- # ' @aliases crc32,Column-method
597+ # ' @rdname column_misc_functions
598+ # ' @aliases crc32 crc32,Column-method
583599# ' @export
584- # ' @examples \dontrun{crc32(df$c)}
585600# ' @note crc32 since 1.5.0
586601setMethod ("crc32 ",
587602 signature(x = " Column" ),
@@ -590,19 +605,13 @@ setMethod("crc32",
590605 column(jc )
591606 })
592607
593- # ' hash
594- # '
595- # ' Calculates the hash code of given columns, and returns the result as a int column.
596- # '
597- # ' @param x Column to compute on.
598- # ' @param ... additional Column(s) to be included.
608+ # ' @details
609+ # ' \code{hash}: Calculates the hash code of given columns, and returns the result
610+ # ' as an int column.
599611# '
600- # ' @rdname hash
601- # ' @name hash
602- # ' @family misc functions
603- # ' @aliases hash,Column-method
612+ # ' @rdname column_misc_functions
613+ # ' @aliases hash hash,Column-method
604614# ' @export
605- # ' @examples \dontrun{hash(df$c)}
606615# ' @note hash since 2.0.0
607616setMethod ("hash ",
608617 signature(x = " Column" ),
@@ -1055,19 +1064,13 @@ setMethod("max",
10551064 column(jc )
10561065 })
10571066
1058- # ' md5
1059- # '
1060- # ' Calculates the MD5 digest of a binary column and returns the value
1067+ # ' @details
1068+ # ' \code{md5}: Calculates the MD5 digest of a binary column and returns the value
10611069# ' as a 32 character hex string.
10621070# '
1063- # ' @param x Column to compute on.
1064- # '
1065- # ' @rdname md5
1066- # ' @name md5
1067- # ' @family misc functions
1068- # ' @aliases md5,Column-method
1071+ # ' @rdname column_misc_functions
1072+ # ' @aliases md5 md5,Column-method
10691073# ' @export
1070- # ' @examples \dontrun{md5(df$c)}
10711074# ' @note md5 since 1.5.0
10721075setMethod ("md5 ",
10731076 signature(x = " Column" ),
@@ -1307,19 +1310,13 @@ setMethod("second",
13071310 column(jc )
13081311 })
13091312
1310- # ' sha1
1311- # '
1312- # ' Calculates the SHA-1 digest of a binary column and returns the value
1313+ # ' @details
1314+ # ' \code{sha1}: Calculates the SHA-1 digest of a binary column and returns the value
13131315# ' as a 40 character hex string.
13141316# '
1315- # ' @param x Column to compute on.
1316- # '
1317- # ' @rdname sha1
1318- # ' @name sha1
1319- # ' @family misc functions
1320- # ' @aliases sha1,Column-method
1317+ # ' @rdname column_misc_functions
1318+ # ' @aliases sha1 sha1,Column-method
13211319# ' @export
1322- # ' @examples \dontrun{sha1(df$c)}
13231320# ' @note sha1 since 1.5.0
13241321setMethod ("sha1 ",
13251322 signature(x = " Column" ),
@@ -2309,19 +2306,14 @@ setMethod("format_number", signature(y = "Column", x = "numeric"),
23092306 column(jc )
23102307 })
23112308
2312- # ' sha2
2313- # '
2314- # ' Calculates the SHA-2 family of hash functions of a binary column and
2315- # ' returns the value as a hex string .
2309+ # ' @details
2310+ # ' \code{sha2}: Calculates the SHA-2 family of hash functions of a binary column and
2311+ # ' returns the value as a hex string. The second argument \code{x} specifies the number
2312+ # ' of bits, and is one of 224, 256, 384, or 512 .
23162313# '
2317- # ' @param y column to compute SHA-2 on.
2318- # ' @param x one of 224, 256, 384, or 512.
2319- # ' @family misc functions
2320- # ' @rdname sha2
2321- # ' @name sha2
2322- # ' @aliases sha2,Column,numeric-method
2314+ # ' @rdname column_misc_functions
2315+ # ' @aliases sha2 sha2,Column,numeric-method
23232316# ' @export
2324- # ' @examples \dontrun{sha2(df$c, 256)}
23252317# ' @note sha2 since 1.5.0
23262318setMethod ("sha2 ", signature(y = "Column", x = "numeric"),
23272319 function (y , x ) {
0 commit comments