Example 1: ta.colApply() - Aster R

Teradata Aster® R User GuideUpdate 3

Product
Aster R
Release Number
7.00.02.01
Published
December 2017
Language
English (United States)
Last Update
2018-04-13
dita:mapPath
fop1497542774450.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
fbp1477004286096
lifecycle
previous
Product Category
Software
This example uses the dataset "Pima.tr" found in the R package "MASS".
  1. Convert the dataset to an Aster virtual data frame "tadf_Pima_tr", and list the first six rows of the data frame.
    tadf_Pima_tr<-as.ta.data.frame(Pima.tr)
    
    ta.head(tadf_Pima_tr)
      npreg  glu  bp skin   bmi    ped age type
    1     5   86  68   28  30.2  0.364  24   No
    2     7  195  70   33  25.1  0.163  55  Yes
    3     5   77  82   41  35.8  0.156  35   No
    4     0  165  76   43  47.9  0.259  26   No
    5     0  107  60   25  26.4  0.133  23   No
    6     5   97  76   27  35.6  0.378  52  Yes
  2. Use the Aster R runner function ta.colApply() to calculate the mean of each numeric column in the dataset.
    ta.colApply(tadf_Pima_tr[1:7], mean)
    
        npreg        glu        bp      skin       bmi      ped       age
     3.570000 123.970000 71.260000 29.215000 32.310000 0.460765 32.110000