From 1107bd958aefc793d6e8e369ad6268b24a0f8510 Mon Sep 17 00:00:00 2001 From: felixcheung <felixcheung_m@hotmail.com> Date: Tue, 20 Oct 2015 21:40:22 -0700 Subject: [PATCH] [SPARK-11221][SPARKR] fix R doc for lit and add examples Currently the documentation for `lit` is inconsistent with doc format, references "Scala symbol" and has no example. Fixing that. shivaram Author: felixcheung <felixcheung_m@hotmail.com> Closes #9187 from felixcheung/rlit. --- R/pkg/R/functions.R | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/R/pkg/R/functions.R b/R/pkg/R/functions.R index a220ad8b9f..a72fb7bb42 100644 --- a/R/pkg/R/functions.R +++ b/R/pkg/R/functions.R @@ -18,16 +18,21 @@ #' @include generics.R column.R NULL -#' Creates a \code{Column} of literal value. +#' lit #' -#' The passed in object is returned directly if it is already a \linkS4class{Column}. -#' If the object is a Scala Symbol, it is converted into a \linkS4class{Column} also. -#' Otherwise, a new \linkS4class{Column} is created to represent the literal value. +#' A new \linkS4class{Column} is created to represent the literal value. +#' If the parameter is a \linkS4class{Column}, it is returned unchanged. #' #' @family normal_funcs #' @rdname lit #' @name lit #' @export +#' @examples +#' \dontrun{ +#' lit(df$name) +#' select(df, lit("x")) +#' select(df, lit("2015-01-01")) +#'} setMethod("lit", signature("ANY"), function(x) { jc <- callJStatic("org.apache.spark.sql.functions", -- GitLab