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 using for loops to calculate the Jaccard distance

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 R-codes for the problem but mistakenly programmed for jaccard distance between shopping items instead of shopping baskets. Please help me to fix this small problem cause I am new to programming.

# 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_2

Step: 3

blur-text-image_3

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

Explain the different types of marketing strategies.

Answered: 1 week ago

Question

Explain product positioning.

Answered: 1 week ago

Question

Explain Industrial market segment.

Answered: 1 week ago