So, I have a high number of dataframes that I need to delete the top and bottom 5% from and afterwards calculate descriptives from the Sums of rows.
I am trying to put as many steps as possible into on command in order to forgo as much typework as possible.
Now I think I am almost there (though my solution my not be as pretty). I set the code up in a way that it calculates me the number of rows that is roughly equal to 5% of the total number of rows and stores it in a vector.
I then try to refer to the vector when using a command to delete the rows in the dataframe.
However, the command does not delete a number of rows equal to the stored value but as it seems only equal to the number of rows in the vector which is of course only 1. e.g.:TEST <- TEST[-c(test), ] (TEST is the dataframe and test is the vector with the calculated number of rows)
Is there a way to refer to the value within test when telling R how many rows it should delete of the top of the dataframe? (To get the top 5% afterwards I would simply resort descending and repeat step 1)
Thanks in advance!