lundi 11 mai 2020

Using an if loop to create matrix using data from three different dataframes

I have three dataframes. One with means of an original dataset and two that represent the 2.75th percentile and 97.5th percentile of null distributions I created using a loop that sampled the original sample.

I have an if loop created that I want to replicate for each to generate a matrix that looks like the same format as my dataframes but just consisting "-", "+" or "0". These symbols are dependent on if the mean from the first dataframe is greater than the 97.25th percentile variable of the third dataframe, if the mean from the first dataframe is lower than than the 2.75th percentile of the second dataframe, and if the mean from the first dataframe is between these two variables. Any ideas about how to go about doing this if loop to accomplish this?

    if (mean > 97.25th percentile){
  print("-")
} else if(mean < 2.75th percentile ) {
  print("+")
} else {
  print("0")
}

Aucun commentaire:

Enregistrer un commentaire