$ {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,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

See Also

Other subsetting functions: [, [, [, [[, subset; filter, filter, where, where

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   # Similar to R data frames columns can also be selected using `$`
##D   df$age
## End(Not run)

[Package SparkR version 1.5.1 Index]