Knitting patterns categories
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Let’s have a look at the repartition of Ravelry patterns among the various categories. The categories have a tree structure. The number of patterns in each category is not accessible via the API, but it is visible on the website main page.
The code below is not the most exciting, but it is a more accurate reflection of the breakdown of knitting patterns in August 2015 than what could be estimated from an API call on the database. I took into account only the patterns that have at least one picture, to avoid potential bad entries (duplicates, drafts …). Some of the categories are aggregated to keep the tree plot simple; the entries named “All Item” are aggregated and actually contain subcategories.
pattern_nbr_tree <- list("Clothing"=list( "Coat/Jacket"=10707, "Dress"=5232, "Intimate Apparel"=list("Bra"=35, "Pasties"=10, "Underwear"=152, "Other"=69), "Leggings"=332, "Onesies"=905, "Pants"=1107, "Robe"=104, "Shorts"=330, "Shrug/Bolero"=3939, "Skirt"=1660, "Sleepwear"=354, "Soakers"=470, "Sweater"=list("Cardigan"=31580, "Pullover"=41795, "Other"=1088), "Swimwear"=135, "Tops"=list("Sleeveles Top"=7195, "Strapless Top"=130, "Tee"=3604, "Other"=550), "Vest"=9256, "Other"=767), "Accesories"=list("All Bag"=8883, "Belt"=271, "Feet/Legs"=list("Booties"=3501, "Legwarmers"=1801, "Slippers"=2188, "All Socks"=23631, "Spats"=89, "Other"=540), "All Hands"=23733, "All Hat"=45386, "All Jewelry"=1642, "Neck/Torso"=list("Bib"=364, "Cape"=1591, "Collar"=921, "Cowl"=17798, "Necktie"=362, "Poncho"=2604, "Scarf"=26600, "Shawl/Wrap"=26210, "Other"=691), "All Other Headwear"=3989, "Other"=1277), "All Home"=36478, "All Toys and Hobbies"=21023, "All Pet"=1551, "All Components"=7073)
This plot shows the number of patterns in each category as the area of the corresponding rectangle.
pattern_nbr_tree <- melt(pattern_nbr_tree) names(pattern_nbr_tree) <- c("patterns_count","cat3","cat2","cat1") custom_palette <- c("#FAF0E6","#7FFFD4","#008080","#FF6347","#FA8072","#B0C4DE") treemap(pattern_nbr_tree,index=c("cat1","cat2","cat3"),vSize="patterns_count", title="Number of knitting patterns per category",palette=custom_palette,border.col="White",border.lwds=c(6,3,0.5), bg.labels=0,fontsize.labels=c(14,13,11), align.labels=list(c("left","top"),c("center","center"),c("center","center")))
Accessories dominate, probably because they represent a smaller time commitment than clothing items, and there are fewer risks on the fit!
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.