[R-sig-DB] Data Frame from a Teradata table

Marco Cetraro m@rco@cetr@ro @end|ng |rom gm@||@com
Tue Sep 22 23:41:44 CEST 2015


Hi all,

I am new in R language.  I have created a data frame in R using a Teradata
table, the statement:

tdf <- td.data.frame("base_08092015_v2")

where base_08092015_v2 is a Teradata table.

summary(tdf)
   numero_id           dias_mora          periodo           saldo
 Min.   :      626   Min.   :  -2.00   Min.   :201002   Min.   :        1
 1st Qu.:   446602   1st Qu.:   0.00   1st Qu.:201201   1st Qu.: 11196611
 Median :  1038866   Median :   0.00   Median :201212   Median : 17477384
 Mean   :  2251666   Mean   :  54.84   Mean   :201244   Mean   : 20259955
 3rd Qu.:  1589698   3rd Qu.:   0.00   3rd Qu.:201310   3rd Qu.: 25689429
 Max    :178371212   Max    :7334.00   Max    :201409   Max    :200000000
                                                        NA's   :    37762
    tipo_id
 Min.   :3.000
 1st Qu.:3.000
 Median :3.000
 Mean   :3.021
 3rd Qu.:3.000
 Max    :9.000


My problem is that I get an error when I try to filter the td.data.frame
tdf:

new_tdf <- tdf[tdf$Dias_Mora > Dias_Mora & tdf$periodo >= Fecha_Inicio_YM &
tdf$periodo <= Fecha_Final_YM & tdf$tipo_id == 3, ]
*Error in `[.td.data.frame`(tdf, tdf$Dias_Mora > Dias_Mora & tdf$periodo >=
 : *
*  Invalid subscript type 'logical'*

Also, when I executed the statement:

dups <- tdf5[duplicated(tdf5$periodo), ]
*Error in `[.td.data.frame`(tdf5, duplicated(tdf5$periodo), ) : *
*  Invalid subscript type 'logical'*


*I don't understand the error.  I searched on the internet as well
as specialize R websites and I couldn't find any information.*

*THANK YOU VERY MUCH.*


-- 
Regards,

Marco Cetraro

	[[alternative HTML version deleted]]




More information about the R-sig-DB mailing list