I'm trying to set up a set of for loops to nest outside a series of if loops. I have a set of parameters I'm trying to cycle through but struggling to set up my code to run through each. I'm really new to R and I'm aware for loops aren't ideal but not sure that the apply family could be used here
So when I run
for(i in seq(from=0.05, to=0.5, by=0.05)){
for(c in 1:5) {
test[c,2] <- i
test[c,1] <- c
c = c + 1
}
print (i)
}
test
    C   I
  1 1 0.5
  2 2 0.5
  3 3 0.5
  4 4 0.5
  5 5 0.5
Ideally I want to get it so I produce a table with the run number, value of the parameter and frequency of another value side by side but struggling to do so.
Effectively I want to find a way to make it:
    C   I
  1 1 0.05
  2 2 0.05
  3 3 0.05
  4 4 0.05
  5 5 0.05
  1 1 0.1
  2 2 0.1
  3 3 0.1
  4 4 0.1
  5 5 0.1
 
    