{"id":105886,"date":"2022-11-08T23:19:47","date_gmt":"2022-11-08T23:19:47","guid":{"rendered":"https:\/\/papersspot.com\/blog\/2022\/11\/08\/ingredientsperorder-functionbs-this-function-determines-the-amount-of-each-ingredient-required\/"},"modified":"2022-11-08T23:19:47","modified_gmt":"2022-11-08T23:19:47","slug":"ingredientsperorder-functionbs-this-function-determines-the-amount-of-each-ingredient-required","status":"publish","type":"post","link":"https:\/\/papersspot.com\/blog\/2022\/11\/08\/ingredientsperorder-functionbs-this-function-determines-the-amount-of-each-ingredient-required\/","title":{"rendered":"IngredientsPerOrder = function(b,s){ #This function determines the amount of each ingredient required"},"content":{"rendered":"<p>IngredientsPerOrder = function(b,s){<\/p>\n<p> #This function determines the amount of each ingredient required for a given order.<\/p>\n<p> #Parameter b is the name of the cupcake box type.<\/p>\n<p> #Parameter s is the order size.<\/p>\n<p> #Example: an order of 100 gift boxes would have b = &#8220;Gift Box&#8221; and s = 100.<\/p>\n<p> #It outputs a vector of size 15, each entry represents the amount of one ingredient<\/p>\n<p> #in the order stablished by the rows of the default inventory data frame.<\/p>\n<p> #The output units of measure are pounds or gallons depending on the ingredient.<\/p>\n<p> ib = numeric(15) #This is the output vector.<\/p>\n<p> cc = numeric(7) #This vector contains the number of batches of each cupcake type in the order.<\/p>\n<p> for (j in 1:7){<\/p>\n<p> cc[j] = CupcakePerBox[b,j]*s\/12<\/p>\n<p> }<\/p>\n<p> for (i in 1:15){<\/p>\n<p> ib[i]=0<\/p>\n<p> for(j in 1:7){<\/p>\n<p> if (i == 7){ib[i] = ib[i] + IngredientPerBatch[i,j]*cc[j]}<\/p>\n<p> else{<\/p>\n<p> if(i %in% c(9,12,14,15)){ib[i] = ib[i] + IngredientPerBatch[i,j]*cc[j]*0.000264172}<\/p>\n<p> else{ib[i] = ib[i] + IngredientPerBatch[i,j]*cc[j]*0.00220462}<\/p>\n<p> }<\/p>\n<p> }<\/p>\n<p> }<\/p>\n<p> return(ib)<\/p>\n<p> }<\/p>\n","protected":false},"excerpt":{"rendered":"<p>IngredientsPerOrder = function(b,s){ #This function determines the amount of each ingredient required for a given order. #Parameter b is the name of the cupcake box type. #Parameter s is the order size. #Example: an order of 100 gift boxes would have b = &#8220;Gift Box&#8221; and s = 100. #It outputs a vector of size [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10],"class_list":["post-105886","post","type-post","status-publish","format-standard","hentry","category-research-paper-writing","tag-writing"],"_links":{"self":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts\/105886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/comments?post=105886"}],"version-history":[{"count":0,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/posts\/105886\/revisions"}],"wp:attachment":[{"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/media?parent=105886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/categories?post=105886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/papersspot.com\/blog\/wp-json\/wp\/v2\/tags?post=105886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}