0

I am new to R, and I unfortunately don't have a nice, simple dataset. I am trying to figure out how to set up my data and code so that it will give me a way to run a comparison on the following:

Image of my data headers in RStudio

Experiment type factor levels ("Experiment"): Control, Heated Competition type factor levels ("Comp"): Inter, Light, Med, Heavy

My goal is to see if there are interactions between temperature (Experiment type factor) and type of competition (Competition type factor) on rates of parasitism ("ParasRate") and rates of survival ("Survival") of the host.

I have tried following this YouTube tutorial.

I think I set something up wrong, since it is asking for numerical values, which my factors of course are not. So I don't think that tutorial by itself is what I need. I need to be able to edit it so I can run it in a meaningful way to look at these interactions. My hypothesis, briefly stated, is that there will be interactions between heat ("Heated") and inter-specific ("Inter") competition.

My data from Excel loads no problem and looks right, so it is not a data file problem.

#fit model using Competition Type and Experiment Type as X-variables
mod_CompExperiment <- (ParasRate ~ Experiment + Level)
summary(mod_CompExperiment)

 mod_CompExperiment <- (ParasRate ~ Experiment + Level)
 summary(mod_CompExperiment)
 Length   Class    Mode 
      3 formula    call 
 summary(mod_CompExperiment)
 Length   Class    Mode 
      3 formula    call 
 cor(ParasRate, Comp, method="pearson")

Error in cor(ParasRate, Comp, method = "pearson") : 'y' must be numeric

NelsonGon
  • 13,015
  • 7
  • 27
  • 57
FlyGuy
  • 1
  • 3
  • 1
    Please add a sample of your data with `dput` not images. Images cannot be used to run code(yet). – NelsonGon Jul 15 '19 at 07:00
  • 1
    You are not fitting anything here! You forgot the function name. Your variables are only the formula – you need something like `lm(ParasRate ~ Experiment + Level)` to actually fit the model. – January Jul 15 '19 at 07:05

0 Answers0