0

So my data set is to analyse the effect of predation on salmon selected for growth. Basically I have a start and ending point, 3 different strains and 2 environments (with and without predator). Does anyone knows the best way to do this?

I was thinking of something like this drawing enter image description here

I have been trying but I can only come up either with the separated time points, in which I would have to do 2 graphs, or with and average of both.

The data set is available here.

https://dryad-assetstore-merritt-west.s3.us-west-2.amazonaws.com/ark%3A/13030/m55q9wc8%7C1%7Cproducer/Salmon_Size_Data.txt?response-content-type=text%2Fplain&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEEgaCXVzLXdlc3QtMiJIMEYCIQD%2FrxcoA78DX5N86nFNROptzvNB%2Bo82OubnJESH4AQF5wIhALF9AuZuZMgV6Ik7EBd9Pje07bsANAT%2BB5R%2BBh24rjJYKswECEEQABoMNDUxODI2OTE0MTU3Igxdeqv51kC67yp3Gr0qqQTdXAWYho6s5Xrf3UFxy0BvZ%2Fm1OUwz%2BSvZS2jSWam%2BcFwyEk2gVOvcZis5PLf%2BAUk43X0wn4S5%2FpXkunbyWiWWlwoV1d%2BOlt8M%2FiyuGrg%2Bzydv2d%2FT6l5zdQ2dxa5ISKLmLHvpl5CzfCB2aChuWTwruTMsssEPZQUyxZy2ihgpbPpjV%2FM5LOfOxcunwJXrMBL4BUk6PCqZQYMpe5NiIOvv7mO58trcPKL5hQ0W4HECtiPtoslFn5Gv5v6KWG4A9VDAfgZwc0TxVmqzzbd6xnb57i6bbfgOyX7PkwFXTuNswa1VJL8Zai08%2BmlmvCXYZyhENYuVTk7K9g3N2aUWlP0nSSMyUKoJPgW45fldrgMMfl7uAH5Budh8EfoFUMQMStuse9gR0qiCHWMbohDao0YcOImNYmoCO5znwTbuDerPsGEzQbrK9YFPKbTpFtm%2Fqc5pAPWw4wWPWcj0PmG2FvNphT3IV8M8jL5Nc%2BNkCM2SbKf82XY2sBar43Xn%2BhPFlsaU%2FkeaFINCSRf29FY6mFNgoKWHfcGbiFoS6gegiFc4iyK7zMjReIFjJ9%2Bsur6HpwWVLG%2Br2JZ8OZjjwg1Uy6tWZ5LxUk%2Fm00fhjIuJyYe6vb%2BL98gKyzL9YXEOEDoEbQ6C%2FCGPsYzKs2mEJSic%2FRxGHIt7%2B4wI7ilcdVnpmoBxiQDYIjD5EYF1UYX2RzXCAb%2Ba4Feb5Y%2FnLv5Wd9lZH67KnrCl%2F%2FP80n%2FUMLmNqJsGOqgBUH4Uc6%2BmRqbTXPRp0NF%2BL6Ieni3hFJbOhhF33xQvrX0R75mGpFCUGSh15B1V%2F%2BQyoPJSJ6KpjBbmhvByzaUNzp9Tu9IRVbrAYaQjU1msReCU7%2B8T6NQnphj%2FizbzJsYEAPxVesRFiGfoH%2FcqjfDSIXDWiJU4pzwyaITjlPe2qawZ06sxXaP%2BxkrgINQ93FHpFTh6DX7kcYUG0dXkwGsDVXYln3pXlXTG&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20221108T081734Z&X-Amz-SignedHeaders=host&X-Amz-Expires=14400&X-Amz-Credential=ASIAWSMX3SNW4W5FR7N3%2F20221108%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=8ab2326025376f5c9b96f2b4e31c51ba5fe15a96743794ac8d6cc48a75efe7e0

I am using this code:

ggplot(data = aqua, mapping = aes(x = Env, y = mass, group = Strain, color = Strain))+
  geom_line(stat = "summary", fun = mean, size = 1, linetype = 2)+
  geom_point(stat = "summary", fun = mean, size = 3)+
  stat_summary(geom = "errorbar", fun.data = mean_se, width = 0.1, size = .5)+
  labs(x = "Environment", y = "Body mass (g)")+
  theme(axis.title.x.bottom = element_text(size = 20), axis.title.y.left = element_text(size = 20))

1 Answers1

0

Since you have not given any data, I made up an example data for you. Next time please include a reproducible example data with your code.

example_data <- tibble(
  strain = rep(c("A", "B", "C"), each = 3),
  env = rep(c("x", "y", "z"), times = 3),
  mass = c(1,4,7,2,6,9,3,8,10)
  )
ggplot(example_data, mapping = aes(x = env, y = mass, group = strain, color = strain))+
  geom_line(size = 1, linetype = 2)+
  geom_point(size = 3) +
  labs(x = "Environment", y = "Body mass (g)")+
  theme(axis.title.x.bottom = element_text(size = 20), axis.title.y.left = element_text(size = 20))

enter image description here

Shubham
  • 220
  • 2
  • 10
  • I edited the post with the data set that I have, as well as with what I have in mind. – Bruno Nunes Nov 08 '22 at 08:26
  • The link does not work for me. You can always use `dput` to put your data directly in your question. See here: https://stackoverflow.com/questions/49994249/example-of-using-dput – Shubham Nov 08 '22 at 12:50
  • The data frame is too big to use that function. I posted the link instead. – Bruno Nunes Nov 08 '22 at 19:16