Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

NxN tabluation over columns in R and check duplicacy between columns

$
0
0

I have a dataframe with unique items procured on rows and their corresponding sources on columns (Basically this is a data which I have "dcast" from original data)

Now it looks like this

DF <- data.frame(Food = c("Burger", "Pizza", "Egg rolls", "Noodles", "Tea", "Coffee", "Biscuits", "Apples", "Bananas"), Source1=c(0,0,1,1,0,0,1,0,0), Source2=c(0,0,1,0,1,0,1,0,1), Source3=c(0,0,0,0,1,0,0,0,1), Source4=c(1,0,0,1,0,0,0,0,0)

)

Now based on this dacasted data I have to create a table which checks for duplicay from sources like this

This is the desired output


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>