Guest User

Untitled

a guest
Nov 13th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. library(RMySQL)
  2. library(reshape)
  3. library(philentropy)
  4. mydb = dbConnect(MySQL(), user='root', password='root', dbname='test_database', host='127.0.0.1')
  5. rs = dbSendQuery(mydb,'select cv.entity_id,cv.attribute_id, cv.value/1000 as value from test_table cv where attribute_id in (145,146,147,148) limit 100')
  6. data = fetch(rs,n=-1)
  7. pivotedData = cast(data,entity_id ~ attribute_id)
  8. pivotedDataConverted = as.data.frame(pivotedData)
  9. pivotedDataDistance = distance(pivotedDataConverted,'euclidean')
Add Comment
Please, Sign In to add comment