Github user felixcheung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8984#discussion_r43976192
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -1914,3 +1914,46 @@ setMethod("attach",
                 }
                 attach(newEnv, pos = pos, name = name, warn.conflicts = 
warn.conflicts)
               })
    +
    +#' Returns the column types of a DataFrame.
    +#' 
    +#' @name coltypes
    +#' @title Get column types of a DataFrame
    +#' @param x (DataFrame)
    +#' @return value (character) A character vector with the column types of 
the given DataFrame
    +#' @rdname coltypes
    +setMethod("coltypes",
    +          signature(x = "DataFrame"),
    +          function(x) {
    +            # Get the data types of the DataFrame by invoking dtypes() 
function
    +            types <- sapply(dtypes(x), function(x) {x[[2]]})
    +
    +            # Map Spark data types into R's data types using DATA_TYPES 
environment
    +            rTypes <- sapply(types, USE.NAMES=F, FUN=function(x) {
    +
    +              # Check for primitive types
    +              type <- PRIMITIVE_TYPES[[x]]
    +              if (is.null(type)) {
    +                # Check for complex types
    +                for (t in names(COMPLEX_TYPES)) {
    --- End diff --
    
    Or
    ```
    Filter(function(t) { grep("start", txt) == 1 }, names(COMPLEX_TYPES))
    ```
    ?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to