Hi
In advance, I'm apologize for being a complete newbie at r
I have a dataframe from a MonteCarlo simulation, 1million rows and 8 columns (values range from 0 to 100million+)
I'm trying to find a way in which i can get the relative frequency of values in each vector that is greater than certain values.
With the function below I can specify which column and what value so that I i.e. can get the relative frequency of how many observations in "column1" have a value greater than 10,000, which is 10,6%
Relative.percent <- function(x, n){ 100*length((which(x > n))) / length(x) }
I.e.
Relative.percent(Results$Event1,10000)
10.6
However this would take me weeks to write out all the different values i want,
as i I'm trying to get the relative frequency of all values greater than 1, 10,000, 20,000, 30,000 ... 100,000,000 so that i can get a detailed graph which would probably look similar to an s curve.
My ideal output would be:
Value__ Event1__ Event2__ Event3 ...
1_______ 0.40____ 0.36____ 0.76
10,000 __ 0.38____ 0.32____ 0.55
20,000 __ 0.27 ____0.19 ____ 0.48
...
Each Event will show the relative frequency of values that are over 1, or over 10,000 or over 20,000 etc
In advance, thank you for your help!