Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Dear all,
I'm trying to analyse the effect of "Factor1" and "Factor2" on the response variable "perf" by "location", and obtaining at the end my original dataset associated to the lsmeans and tukey groups letters. Here below the code I'm using that gives me exactly what I need but only by location, my need is : how can I extend it in a way my output combines results of all locations, i.e, output of lsmeans and CLD by location :
library(multcomp) library(lsmeans) library(dplyr) library(broom) output <- as.data.frame(dataset) output$perf <- as.numeric(output$perf) output$factor1 <- as.factor(output$factor1) output$factor2 <- as.factor(output$factor2) output <- output %>% group_by(location) %>% mutate(row=row_number()) model <- lm(perf ~ factor1 + factor2, data = output) lsmeans <- lsmeans(model, ~ factor1) CLD = cld(lsmeans, alpha = 0.05, Letters = letters, adjust = "tukey") output <- left_join(output, CLD, by = "factor1")
Solved! Go to Solution.
Hi @Betty888
You can consider to create a new column instead of group_by, you can refer to the following link, it may help you.
Concatenating strings with multiple separators using paste() in R - Stack Overflow
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Betty888
You can consider to create a new column instead of group_by, you can refer to the following link, it may help you.
Concatenating strings with multiple separators using paste() in R - Stack Overflow
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Many thanks !
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
17 | |
9 | |
8 | |
7 | |
7 |