All Forums Analytics
attackover 1 post Joined 01/13
24 Apr 2013
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"]) )

ulrich 816 posts Joined 09/09
24 Apr 2013

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.

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

toddb 13 posts Joined 10/10
29 May 2013

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
 
 

You must sign in to leave a comment.