Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
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 !