vendredi 14 décembre 2018

Error in if ((data[row, 6] > 210)) { : missing value where TRUE/FALSE needed

For my bachelor thesis, I conducted a prototype experiment. With this experiment I tracked the pupil size of participants with an eyetracker. Now I am analyzing this data of the eyetracker in R.

# Make a list for the average value when someone is looking at the chatbot avatar
pupilsizerightlijstcb = list()

# Make a list for the average value when someone is not looking at the chatbot avatar
pupilsizerightlijstnocb = list()

# Necessary for the for-statement
i3 = 0
i4 = 0

# If the user looks at the chatbot avatar (x between 210 en 320), pupil size gets added to pupilsizeleftlijstcb
# Otherwise pupil size added to pupilsizeleftlijstnocb
for (row in 1:rijenaantal) {
  if ((data[row,6] > 210) & (data[row,6] < 320)) {
    pupilsizerightlijstcb[i3] = data[row,8]
    i3 = i3+1
  } else {
    pupilsizerightlijstnocb[i4] = data[row,8]
    i4 = i4 + 1
  }
}

Now, I made this code. But I get the following error:

Error in if ((data[row, 6] > 210)) { : 
  missing value where TRUE/FALSE needed

You would assume that there is a NA value in my dataset, but when I try the following code:

any(is.na(data))
[1] FALSE

You notice, that a NA value is not the problem.

Could anybody help me with this?

Best Regards,

Joren

Aucun commentaire:

Enregistrer un commentaire