The "items2test" parameter in the DIF command currently doesn't function correctly when passed a character vector of the items to be tested. Rather than testing the items with the names given, it tests the first n items, where n is the number of items given in the "items2test" list.
I think this is due to an issue in the "which" command used in line 279 in DIF.R:
if(is.character(items2test)) items2test <- which(items2test %in% itemnames)
The %in% command returns a vector that lists if each element in items2test is in itemnames. So, if you want to test items 13 and 15 out of a 20-item set, and the item names for 13 and 15 are in itemnames, the %in% command returns "TRUE TRUE". The which command then looks at which indices of that vector are T/F, and will return "1 2", so the first two items of the 20 will be tested for DIF.
If switched (itemnames % items2test), then %in% will check if each of the itemnames is in the list of items2test, and return a T/F vector for those. In the example above, it would return a 20-element vector with items 13 and 15 as TRUE, and the "which" command would return "13 15", selecting the right elements to test for DIF.
The "items2test" parameter in the DIF command currently doesn't function correctly when passed a character vector of the items to be tested. Rather than testing the items with the names given, it tests the first n items, where n is the number of items given in the "items2test" list.
I think this is due to an issue in the "which" command used in line 279 in DIF.R: if(is.character(items2test)) items2test <- which(items2test %in% itemnames)
The %in% command returns a vector that lists if each element in items2test is in itemnames. So, if you want to test items 13 and 15 out of a 20-item set, and the item names for 13 and 15 are in itemnames, the %in% command returns "TRUE TRUE". The which command then looks at which indices of that vector are T/F, and will return "1 2", so the first two items of the 20 will be tested for DIF.
If switched (itemnames % items2test), then %in% will check if each of the itemnames is in the list of items2test, and return a T/F vector for those. In the example above, it would return a 20-element vector with items 13 and 15 as TRUE, and the "which" command would return "13 15", selecting the right elements to test for DIF.