Teradata Package for R Function Reference | 17.00 - summarise - Teradata Package for R - Look here for syntax, methods and examples for the functions included in the Teradata Package for R.

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:id
B700-4007
NMT
no
Product Category
Teradata Vantage
Summarise a grouped or ungrouped column

Description

Creates one or more columns summarizing the columns of tbl_teradata. Tibbles with groups created by 'group_by()' and 'group_by_time()' will result in one or more rows in the output for each group based on the aggregate operation used in summarise. Tibbles without groups will result in one or more rows in the output based on the aggregate operation.

Usage

## S3 method for class 'tbl_teradata'
summarise(.data, ...)

Arguments

.data

Required Argument.
Specifies the tbl_teradata which contains the columns on which aggregate operations are to be performed.

...

Name-value pairs of summary functions. The name specifies the name of the column in the result tbl_teradata. The value specifies an expression that returns a single value like ‘min(x)', 'n()', or 'sum(is.na(y))' where ’x' and 'y' are the column names.

Value

A 'tbl_teradata' object.

See Also

summarise function in the dplyr package for some other examples of summarise.

Examples


# Get remote data source connection.
con <- td_get_context()$connection

# Load the required tables.
loadExampleData("time_series_example", "ocean_buoys_seq")

# Create object of class "tbl_teradata".
df_seq <- tbl(con, "ocean_buoys_seq")

# Example 1: Get the minimum of the column 'temperature', grouped by timebucket
#            timebucket duration of 30 minutes and the column 'buoyid'.

# Grouping by timebucket duration of 30 minutes and 'buoyid'.
seq_group1 <- df_seq %>% group_by_time(timebucket.duration = "30m",
                                       value.expression = "buoyid")

# Applying min() aggregation on grouped tbl object.
seq_group1 %>% summarise(min_temp = min(temperature))

# Example 2: Get the minimum of the column 'temperature' grouped by the
#            column 'buoyid'.

# Grouping by column 'buoyid'.
seq_group2 <- df_seq %>% group_by(buoyid)

# Applying min() aggregation on grouped tbl object.
seq_group2 %>% summarise(min_temp = min(temperature))