0

I have 4 different treatment combinations with all of the different variables in different columns. For examples, treatment, drought, genotype, block, date, plant. But I would like to group these within the columns and rows. Since my experimental design is in block effects, I have replicates in each of the multiple blocks. I have used dplyr and subset but I am not sure if I can list multiple things using this. So for a given treatment I would need an example such as this: all the genotype 1 in block 1, with drought and biochar as an effect.

I would need to subset the subset essentially

Abby
  • 1
  • 1
  • 1
    This is hard to follow. Please share a small example of input and show the desired output. For example purposes, it is probably enough to consider 2 treatments, 2 drought conditions, and 2 genotypes, and ignore the rest, and we'll keep in mind that the solution needs to scale up. (Or something like that--pick your 3 favorites.) – Gregor Thomas Oct 11 '22 at 18:42
  • this is what i need to filter is having all the data that say drought but also the treatment is biochar, and i want all genotype values library(dplyr) BD<-filter(dat,drought=="drought", treatment=="biochar", genotype=="ALL") – Abby Oct 11 '22 at 19:12
  • 1
    So what's not working with `BD<-filter(dat,drought=="drought", treatment=="biochar", genotype=="ALL")`? That code looks fine. I really do think some sample data and desired output would make things much clearer... could you please put some sample data in the question? – Gregor Thomas Oct 11 '22 at 19:26
  • Similar to what Gregor asked: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – John Polo Oct 11 '22 at 20:30
  • I've figured it out I needed to put an & for the subset I needed library(dplyr) BD<-filter(dat,drought=="drought" & treatment=="biochar") NBD<-filter(dat,drought=="drought" & treatment=="no biochar") BND<-filter(dat, drought=="no drought" & treatment=="biochar") NBND<-filter(dat, drought=="no drought" & treatment=="no biochar") – Abby Oct 13 '22 at 17:59

0 Answers0