loadExampleData() | Teradata R Package - 17.00 - loadExampleData() - Teradata R Package

Teradata® R Package User Guide

prodname
Teradata R Package
vrm_release
17.00
created_date
November 2020
category
User Guide
featnum
B700-4005-090K

The loadExampleData() function helps users to load the sample datasets.

tdplyr offers various API's and each API provides some examples. To try the API's in these examples, you need the sample datasets loaded in Vantage. The loadExampleData() function enables the user to load these sample datasets.

This function can only be used in a restricted way. Function arguments can only accept predetermined values, which are found only in loadExampleData() function calls given in the examples provided in Teradata R Package Function Reference and this User Guide.

  • If the table with the name provided in the function call already exists, this function skips creation and loading of the dataset.
  • This function creates a new table in Vantage. You must drop the table manually if required.

Example

  • Drop the table if it already exists.
    > try(db_drop_table(con, "computers_train1"), silent = TRUE)
  • Check table in Vantage.
    > db_has_table(con, "computers_train1")
    [1] FALSE
  • Load example dataset in Vantage.
    > loadExampleData("kmeans_example", "computers_train1")
    Loading:  ALICE.computers_train1 ....
  • Check table in Vantage again.
    > db_has_table(con, "computers_train1")
    [1] TRUE
  • Print the tbl_teradata of the table loaded to Vantage.
    > tbl(con, "computers_train1")
    # Source:   table<computers_train1> [?? x 6]
    # Database: [Teradata 16.20.50.01] [Teradata Native Driver 17.0.0.2] [TDAPUSER@server.labs.teradata.com/TDAPUSERDB]
          id price speed    hd   ram screen
       <int> <int> <int> <int> <int>  <int>
     1  6036  1445   100   528     4     14
     2  1407  2644    66   426     8     14
     3  1672  1944    50   107     2     14
     4   265  1899    50   120     4     14
     5   469  2599    50   405     8     14
     6  5832  1490    66   340     4     15
     7  3487  1999    33   420     8     15
     8  4221  1695    66   425     8     15
     9   938  2799    50   320     8     15
    10  4894  1739    33   212     4     17
    # ... with more rows
    >