td_nrow() | Teradata R Package - 17.00 - td_nrow() - 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 td_nrow() function retrieves number of rows in a tbl_teradata or data.frame object.

Example Setup

  • Load example dataset.
    > loadExampleData("antiselect_example", "antiselect_input")
  • Create object of class "tbl_teradata".
    > df <- tbl(con, "antiselect_input")
  • Create a R data.frame from tbl_teradata object.
    > df2 <- as.data.frame(df)

Example

  • Print the tbl_teradata.
    > df
    # Source:   table<antiselect_input> [?? x 13]
    # Database: [Teradata 16.20.50.01] [Teradata Native Driver 17.0.0.2] [TDAPUSER@<hostname>/TDAPUSERDB]
      rowids orderid orderdate priority quantity  sales discount shipmode custname province region custsegment
       <int>   <int> <chr>     <chr>       <int>  <dbl>    <dbl> <chr>    <chr>    <chr>    <chr>  <chr>     
    1      1       3 2010-10-~ low             6 2.62e2     0.04 regular~ muhamme~ nunavut  nunav~ small busi~
    2     97     613 2011-06-~ high           12 9.35e1     0.03 regular~ carl ja~ nunavut  nunav~ corporate 
    3     85     515 2010-08-~ not spe~       19 3.94e2     0.08 regular~ carlos ~ nunavut  nunav~ consumer  
    4     80     483 2011-07-~ high           30 4.97e3     0.08 regular~ clay ro~ nunavut  nunav~ corporate 
    5     86     515 2010-08-~ not spe~       21 1.47e2     0.05 regular~ carlos ~ nunavut  nunav~ consumer  
    6     50     293 2012-10-~ high           27 2.45e2     0.01 regular~ barry f~ nunavut  nunav~ consumer  
    7     49     293 2012-10-~ high           49 1.01e4     0.07 deliver~ barry f~ nunavut  nunav~ consumer  
    # ... with 1 more variable: prodcat <chr>
  • Get the number of rows of tbl_teradata object.
    > td_nrow(df)
    integer64
    [1] 7
  • Get the number of rows of R data.frame.
    > td_nrow(df2)
    [1] 7