Thank you! yes this does answer the question if there are only two columns!
However, I have an unequal number of columns in each condition and when specifying these columns i get an error that the data frames are not of equal size. Here is my reproducible example:
#> condition 1 condition 2 condition1 condition 1 condition 2
#> 1 5.1 3.5 6 5 3.1
#> 2 4.9 3.0 5 5.2 3
#> 3 4.7 3.2 4.2 4.8 2.7
#> 4 4.6 3.1 4.9 4.9 3.5
#> 5 5.0 3.6 6 5 3.9
#> 6 5.4 3.9 4.2 5.2 4
Condition 1 are all linked and conditions 2 are all linked. I could get the average by rowMeans(df) of condition 1 and the same for condition 2 and then carry out the code above.
I would also like to be able to to avoid the averaging of columns approach as well if possible by specifying that if there is for example, a change in at least 2 columns of condition 1 to at least 2 columns of condition 2 of a value of 'x', then subset the dataframe to the row meeting this criteria.
I have subset the data frame above in the example as follows:
entire dataframe= df
condition1<- "col1", "col3" condition2<- "col2", "col4", "col5" ...etc
please note that the total number of columns for condition 1 is not equal to the total number of columns for conditions. condition 1 may have 20 columns and condition 2 15. This is just the nature of the experiment.
df[,condition1]
df[,condition2]
each correctly subset the appropriate columns....
It is from here i would like to specifcy, for example, if the value of condition 1 changes in at least for example, 4 samples in condition 1 relative to 4 columns of condition 2 (or any other number of columns) with a change value of 'x', subset the data frame.
Please note that the value of x should be a change in any direction as in the original post, so if it is a value of 1, it could change by a value of 1 up from condition one to two (for example 1-2) or down by a value of 1 (for example 2-1).. again the solution you provided is perfect, but for is only working for individual or equal sized columns!
hope this makes sense?
thank you in advance!!