Github user HyukjinKwon commented on a diff in the pull request: https://github.com/apache/spark/pull/18447#discussion_r124473417 --- Diff: R/pkg/R/functions.R --- @@ -598,6 +598,25 @@ setMethod("hash", column(jc) }) +#' data_type +#' +#' Returns the data type of a given column. +#' +#' @param x Column to get the data type. +#' +#' @rdname data_type +#' @name data_type +#' @family misc functions +#' @aliases data_type,Column-method +#' @export +#' @examples \dontrun{data_type(df$c)} --- End diff -- In R, I think we could do this as below: ```r > df <- createDataFrame(iris) > lapply(schema(df)$fields(), function(s) { s$dataType.simpleString() }) [[1]] [1] "double" [[2]] [1] "double" [[3]] [1] "double" [[4]] [1] "double" [[5]] [1] "string" ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org