I am working with Rstudio on a dataset that includes two treatments and a response that is in Kg. I am trying to summarize and get the mean of kg by TRT. However, I got the same values for both responses. My dataset is much bigger than the data enclosed below but are the same variables.
However, when I work with those nine values, I get the real response, but I get the same mean for both when I work with my dataset (second code). I have no idea what I am missing.
Trt Kg
<chr> <dbl>
CON 38.6
CON 37.2
CON 31.3
CON 33.1
CON 36.3
TRT 34.8
TRT 33.4
TRT 33.5
TRT 33.3
EXPBW <-data.frame(Trt, kg)
EXPF <- EXPBW %>%
dplyr::group_by(Trt) %>%
dplyr::summarize(mean_cw = mean(kg))
View(EXPF)
trt mean_cw
TRT 33.75
CON 35.30
Clearly when I work with a small dataset works
However, when I work with my real dataset I get the same mean values for the two groups
SECOND DATASET
CW <- tabla %>%
dplyr::group_by(tabla$Trt) %>%
dplyr::summarize(mean_cw = mean(tabla$CBWKg))
View(CW)
tabla$Trt mean_cw
GB 37.93381
CON 37.93381