<jupyter_start><jupyter_text>which are establishment types of busienss for all the business share (top 10)<jupyter_code>Ltr <- LETTERS[c(-24, -25)]
store <- c()
for (i in 1:  length(Ltr)){
    lgn <- lapply(dfData$Establishment, grep, pattern = Ltr[i])
    frm <- as.data.frame(unlist(lgn),recursive = FALSE, use.names = FALSE) 
    if(nrow(frm) != 0){
       store[i] <- length(frm[frm == 1,])
    }
    else{
         store[i] <- 0
    }
}
OCCUR <- data.frame(Establishment.Code = as.vector(Ltr), Number.Occurrences = store)

OccurTop10 <- OCCUR[order(OCCUR$Number.Occurrences, decreasing = TRUE),c(1,2)][1:10,]
A(3)– Store 28-A M – Salvage Dealer 17-B
B – Bakery 20-C N – Wholesale Produce Packer
C – Food Manufacturer 20-C O – Produce Grower/Packer/Broker, Storage
D – Food Warehouse 28-D P – C.A. Room
E – Beverage Plant 20-C Q – Feed Mill/Medicated 8
F – Feed Mill/Non-Medicated 8 R – Pet Food Manufacturer 8
G - Processing Plant 20 S – Feed Warehouse and/or Distributor 8
H - Wholesale Manufacturer 20-C T – Disposal Plant 5-C
I - Refrigerated Warehouse 19 U - Disposal Plant/Transportation Service 5-C
J – Multiple Operations V – Slaughterhouse 5-A
K - Vehicle W – Farm Winery-Exempt 20-C, for OCR Use
L - Produce Refrigerated Warehouse 19 Z - Farm Product Use Only
Code <- mutate(OccurTop10, EstCode_Names = c("Store", "Multiple Operations", "Food Manufacturer", "Bakery", 
"Wholesale Manufacturer", "Vehicle", "Food Warehouse", "Farm Winery-Exempt", "Produce Grower/Packer/Broker", "Beverage Plant" ))
Code<jupyter_output><empty_output><jupyter_text>what is the most common Establishment.Type for retail buisness in NY area (Top 10)<jupyter_code>group <- group_by(df, Establishment.Type) 
counts <- summarize(group, count = n())


counts[order(counts$count, decreasing = TRUE),c(1,2)][1:10,]
## convert dataframe into vextor
as.vector(unlist(counts[,1]))<jupyter_output><empty_output><jupyter_text>all establish type and its accorded avg footsqaure<jupyter_code>dfMelt <- melt(df, id =c("License.Number", "Establishment.Type", "Address", "Street.Number", 
                         "State", "ZipCode", "County", "Longitude", "Latitude"), measure.vars = c("Square.Footage" ))

EstabType <- dcast(dfMelt, Establishment.Type ~ variable, mean)
EstabType<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13592657342657344, 'fraction_numerical': 0.024912587412587412, 'mean_word_length': 4.5423728813559325, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '57894', 'license': 'MIT', 'n_tokens_mistral': 902, 'n_tokens_neox': 809, 'n_words': 237, 'path': 'NY_Retail_Food_Store/WorkBook/Reshape and Analyze Data.ipynb', 'repo_name': 'Mikelaifu/JohnHopkinR-DataScienceProjects', 'size': '2288'}