Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(RMySQL)
- library(reshape)
- library(philentropy)
- mydb = dbConnect(MySQL(), user='root', password='root', dbname='test_database', host='127.0.0.1')
- 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')
- data = fetch(rs,n=-1)
- pivotedData = cast(data,entity_id ~ attribute_id)
- pivotedDataConverted = as.data.frame(pivotedData)
- pivotedDataDistance = distance(pivotedDataConverted,'euclidean')
Add Comment
Please, Sign In to add comment