TeradataR Question about kemans analysis

Analytics

TeradataR Question about kemans analysis

HI,

I am using teradataR (1.01) to do some clustering analysis, but I found the td.kmeans function can only receive a full table as the input.

So my question is can I assign some columns to td.kmeans and make it do analysis only on these columns?

like this way:

>  test <- td.data.frame("test", "testdb")

>  td.kmeans( cbind(test["x"], test["y"]) )

2 REPLIES
Supporter

Re: TeradataR Question about kemans analysis

Can't test it right now as teradataR is not working for R3.0.0 :-(

What should work is that you create a view with your two columns and call td.kmeans with this view.

Teradata Employee

Re: TeradataR Question about kemans analysis

Actually the td.kmeans function takes a td.data.frame as input and td.data.frames can be used almost identically to a regular R data.frame.  cbind won't work because it doesn't know about td.data.frames.  You can use the following:

td.kmeans(test[1:2])                      //Use first two columns

OR

td.kmeans(test[c('col1','col2')])    //Use columns named col1 and col2