Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following table shows sales of different items (A, B, C,....,G) at a grocery. Write R-codes possibly usingfor loops to calculate the Jaccard distance in

The following table shows sales of different items (A, B, C,....,G) at a grocery. Write R-codes possibly using"for" loops to calculate the Jaccard distance in order to compute similarities between all shopping basket pairs. Ex:The Jaccard distance for shopping baskets CA and CB is defined by

image text in transcribed

Shopping baskets A B C D E F G
CA 5 0 0 0 2 1 2
CB 2 1 2 0 0 0 0
CC 0 0 1 4 0 0 1
CD 0 0 2 0 1 1 2
CE 6 2 2 0 1 1 2
CF 4 0 0 2 0 0 2

I have got the following nice R-codes from sombody for the problem but mistakenly programmed for jaccard distance between shopping items instead of shopping baskets. Please fix that problem in the program below.

# reading the data from csv groccery

#getting all column nameexcpet first one b

#creating a list to store jacard distance for all pair l

for(x in b){ for(y in b){ if(x!=y){ num

#printing jacard distacne for each paire for(x in names(l)){ print(paste(x,l[[x]],sep = " "),quote=FALSE) cat(" ") }

CA n CB CA U CB

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

=+j What rules will apply to the process of negotiations?

Answered: 1 week ago