Creating a tibble from a Table in Vantage | Teradata Package for R - Creating a tibble from a Table in Vantage - Teradata Package for R

Teradata® Package for R User Guide

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:mapPath
yih1585763700215.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
B700-4005
Product Category
Teradata Vantage

Use the tbl() function of the "dplyr" package to create a tdplyr tibble from an existing table in a database in Vantage.

A tdplyr tibble is an R table that resembles an R tibble, that is, a form of data frame. The difference between a tdplyr tibble and an R tibble is that the output object of tbl() function shows that a tdplyr tibble is a remote source in a database in Vantage.

Example: Create a tdplyr tibble object "tddf_iris" from the existing table "iris_flowers" in Vantage

> tddf_iris <- tbl(con, "iris_flowers")

At the prompt, enter tddf_iris to receive the following output (first ten rows shown here):

> tddf_iris
# Source: table<iris_flowers> [?? x 5]
# Database: [Teradata 16.20.49.01] [Teradata Native Driver 16.20.0.34]
# [TDAPUSER@<hostname>/TDAPUSERDB]
   Sepal.Length Sepal.Width Petal.Length Petal.Width Species  
          <dbl>       <dbl>        <dbl>       <dbl> <chr>    
 1          6.2         2.9          4.3         1.3 versicolor
 2          7.3         2.9          6.3         1.8 virginica
 3          6.3         3.3          4.7         1.6 versicolor
 4          6.3         2.5          4.9         1.5 versicolor
 5          7.1         3            5.9         2.1 virginica
 6          5.4         3.9          1.7         0.4 setosa   
 7          5.4         3.7          1.5         0.2 setosa   
 8          5.4         3.9          1.3         0.4 setosa   
 9          7.2         3.6          6.1         2.5 virginica
10          7.2         3.2          6           1.8 virginica
# ... with more rows