1

I'm a PhD student who's currently navigating R.

I've got a rather large dataset looking at the mass of leaves, organized by where they're found on the plant. For a part of this project, we'd like to see the combined mass and mean mass for the treatments.

Unfortunately, our code seems to be just summing up the mass of all leaves in the study.

I've pared down all the packages to 4 essential packages to eliminate the possibility of conflicts between the packages, and I've used Conflicted to try and determine if there's any conflicts (there aren't).

The output for the code below is simply 47588, the combined mass of all leaves in this study. It should be analyzing them using our treatments.

What do y'all think?

Mass.dat <- read_excel("CoSAR Final.xlsx", sheet = "ImageJ", na="NA") %>%
  mutate(Treatment = as.factor(Treatment),
         Whorl = as.factor(Whorl))
Mass.mean<-summarySE(Mass.dat,measurevar = "Leaf.Mass",
                      groupvars = c("Whorl","Treatment"),
                                           na.rm = T)
Mass.mean2 <- Mass.dat %>% 
group_by(Treatment) %>%
summarize(Leaf.Mass.mean = sum(Leaf.Mass, na.rm=TRUE))

data.frame(Mass.mean2)


1 Answers1

0

It may be the dplyr::summarise got masked by plyr::summarise

 Mass.dat %>% 
  group_by(Treatment) %>%
  dplyr::summarize(Leaf.Mass.mean = sum(Leaf.Mass, na.rm=TRUE))
akrun
  • 874,273
  • 37
  • 540
  • 662
  • 1
    Okay, yeah! Thanks! That is exactly what happened, and the Conflicted package must not have detected this because they're both under the Tidyverse umbrella. Unfortunately, this led to a problem creating the graphs...but I guess I can just post another Q. Thanks so much! – Joe Ballenger May 02 '21 at 20:37