I have a dataframe where the first column consists of the numbers 0,0.01,...,0.99,1. Using the which() function i'm trying to find the row indices that contain a certain set of numbers in the first three columns. Peculiarly, this does does not work for the numbers 0.35, 0.41, 0.47, 0.57, 0.69, 0.70, 0.82, 0.83, 0.94 and 0.95 in the first column. I'm sure they exist in the data frame, but which() returns integer(0) each time. Can anybody help?
StateIndex = function(state)
{
state = as.numeric(state)
aux = which(states[,colnames(states)[1]] == state[1])
for (i in 2:3)
{
aux = aux[which(states[aux,colnames(states)[i]] == state[i])]
}
return(aux)
}
states = list()
states[[1]] = seq(0,1,by=1/M) #zeta1 at last action
states[[2]] = 1:(m+1) #i (last observed det. level)
states[[3]] = 0:N #j (time since last action)
states = expand.grid(states)
nstates = dim(states)[1]