How to automate a process by pulling elements from a data frame in R -looping with a string?

44 views Asked by At

I am trying to automate a process instead of individually compute PPCC values for a large number of test cases. The details of my functions do not matter (though for reference I'm using Lmomco), my issue is either putting this into a loop or somehow using plyr or apply to repeat over and over. I do not know how to automate the string. For example I have sorted data by "M" parameter:

testx.100cv1<-by(x.cv1$first_year,x.cv1$M,sort)

I then apply a function here:

testexp<-lapply(testx.100cv1,parexp)

Now I want to do something to each "M", where in the example below, M = 1.02. Right now, I am manually changing this value and then recomputing for every M (and I have a lot of them). I'm looking for a way to write this M value into a loop so it reads it automatically.

exp<-quaexp(plotpos,testexp$'1.02')
PPCCexp<-cor(exp,testx.100cv1$'1.02')

I want to compute PPCC values for many distributions, so without automating, this will take over my life for a week. Thanks!

0

There are 0 answers