Error: invalid subscript type 'list'

Hi, I've been trying to solve this error, could you help me out with it? Thank you! :smile:


ifelse((NRIC_DF $ ALP == "S" | NRIC_DF $ ALP == "T"),
fin <- c("J", "Z", "I", "H", "G", "F", "E", "D", "C", "B", "A")[result + 1],
fin <- c("X", "W", "U", "T", "R", "Q", "P", "N", "M", "L", "K")[result + 1])

Error in c("X", "W", "U", "T", "R", "Q", "P", "N", "M", "L", "K")[result + : invalid subscript type 'list')

Welcome in the Community!
Your code is not well readable here. If you enclose it with three backticks (before and after your code) it will be much better readable.
(On my keyboard I have a backtick on the key left of the '1' key but by clicking the </> button in the Reply panel you get Preformatted text with backticks around it.)

The error seems to indicate that something is wrong with result : it is a list and not a number or numbers. Could it be that the result is empty where you expected a number?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.