$,DataFrame-method {SparkR}R Documentation

Select

Description

Selects a set of columns with names or Column expressions.

Usage

## S4 method for signature 'DataFrame'
x$name

## S4 replacement method for signature 'DataFrame'
x$name <- value

## S4 method for signature 'DataFrame'
x[[i]]

## S4 method for signature 'DataFrame,missing,ANY'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'DataFrame,character'
select(x, col, ...)

## S4 method for signature 'DataFrame,Column'
select(x, col, ...)

## S4 method for signature 'DataFrame,list'
select(x, col)

select(x, col, ...)

selectExpr(x, expr, ...)

Arguments

x

A DataFrame

col

A list of columns or single Column or name

Value

A new DataFrame with selected columns

Examples

## Not run: 
##D   select(df, "*")
##D   select(df, "col1", "col2")
##D   select(df, df$name, df$age + 1)
##D   select(df, c("col1", "col2"))
##D   select(df, list(df$name, df$age + 1))
##D   # Columns can also be selected using `[[` and `[`
##D   df[[2]] == df[["age"]]
##D   df[,2] == df[,"age"]
##D   # Similar to R data frames columns can also be selected using `$`
##D   df$age
## End(Not run)

[Package SparkR version 1.4.0 Index]