GGplot and anova from multiple dataframes

Hi everyone!

I have analysis to do on several data frames; I have:

10 countries
60 plants
60 traits
1 data frame per country containing 60 traits for 60 plants
1 data frame per country containing climatic data

example:

SWD_data

  ...1   bolting flowering `life span` colour
   <chr>  <chr>   <chr>     <chr>       <chr> 
 1 rose   15      56        12          R     
 2 cabage 14      56        21          G     
 3 carrot 10      43        35          O     
 4 iris   52      12        62          B     

FRA_data

  ...1   bolting flowering `life span` colour
   <chr>  <chr>   <chr>     <chr>       <chr> 
 1 rose   15      54        12          Rg     
 2 cabage 14      65        84          G     
 3 carrot 10      43        35          P     
 4 iris   52      12        67          B     

SWD_environment

  ...1    Rain    PAR       Temp        Wind
   <chr>  <chr>   <chr>     <chr>       <chr> 
 1 Day1    15      54        12          0
 2 Day2    14      65        84          11
 3 Day3    10      43        35          45
 4 Day4    52      12        67          0

FRA_environment

  ...1    Rain    PAR       Temp        Wind
   <chr>  <chr>   <chr>     <chr>       <chr> 
 1 Day1    15      54        12          10
 2 Day2    14      65        84          0
 3 Day3    10      43        35          0
 4 Day4    52      12        67          0

My goal is to cross all the data in multiple analysis:

  • bolting of all roses depending on rain
  • mean flowering of all roses regardless on the environment
  • flowering of all plants depending on rain
  • best plant to grow in Sweden
  • most impacting environmental variable
  • trait most sensitive to environmental fluctuation
  • ...

To archive that I would need to ask R to draw graphics such as:

ggplot( y= (SWD_data$bolting, FRA_data$bolting), x= c(SWD_E$Rain, FRA_E$Rain))

Or anova functions that compute data from different tables.

So I am sorry this topic is a bit wide, but any advice and help would be strongly appreciated!

All the best!

Hi, I assume that SWD and FRA are the countries and that all the data have the countries as the prefix. You would want to read in all the files using something like this so that they are in one data frame but with a column called country.

Reading and combining many tidy data files in R | Claus O. Wilke (clauswilke.com)

From there you could run the ANOVAs on whatever groups of countries or environments.

Thank you very much ! My dataframes are of different dimensions, I will read the topic you attached, hope it helps, great thanks :slight_smile:

1 Like