search for: pricestor

Displaying 3 results from an estimated 3 matches for "pricestor".

Did you mean: pricestore
2018 May 26
3
Grouping by 3 variable and renaming groups
ALCON I'm trying to figure out how to rename groups in a data frame after groups by selected variabels. I am using the dplyr library to group my data by 3 variables as follows # group by lat (StoreX)/long (StoreY) priceStore <- LapTopSales[,c(4,5,15,16)] priceStore <- priceStore[complete.cases(priceStore), ] # keep only non NA records priceStore_Grps <- priceStore %>% group_by(StorePC, StoreX, StoreY) %>% summarize(meanPrice=(mean(RetailPrice))) which results in . > priceStore_Grps...
2018 May 26
0
Grouping by 3 variable and renaming groups
Hello, See if this is it: priceStore_Grps$StoreID <- paste("Store", seq_len(nrow(priceStore_Grps)), sep = "_") Hope this helps, Rui Barradas On 5/26/2018 2:03 PM, Jeff Reichman wrote: > ALCON > > > > I'm trying to figure out how to rename groups in a data frame after groups > by...
2018 May 26
1
Grouping by 3 variable and renaming groups
Hello, Sorry, but I think my first answer is wrong. You probably want something along the lines of sp <- split(priceStore_Grps, priceStore_Grps$StorePC) res <- lapply(seq_along(sp), function(i){ sp[[i]]$StoreID <- paste("Store", i, sep = "_") sp[[i]] }) res <- do.call(rbind, res) row.names(res) <- NULL Hope this helps, Rui Barradas On 5/26/2018 2:22 PM, Rui Barradas wrote...