argument must be coercible to non-negative integer in R
12,171
This error message appears when a function expects a number but receives something else.
For example the seq_len
function expects a number:
seq_len(3) # no error, since function receives a number
seq_len(NA_character_) # Errors, since function expected a number and did not receive one
seq_len("a") # Errors, since function expected a number and did not receive one
You Should scrutinise your code and data for any instance where a function expects to receive a number but instead receives something else (like a character string or NA). NAs in your data could be a good place to start looking
Author by
akhicoda
Updated on June 29, 2022Comments
-
akhicoda almost 2 years
I am trying to run the following command on my dataset;
pbad2way(formula = Balance~Occupation+Gender+Occupation:Gender, data = plxsell, est= "mom", nboot= 5000)
name of dataset is plxsell Balance, Occupation, Gender are the columns
but i am receiving following error;
Error in FUN(X[[i]], ...) : argument must be coercible to non-negative integer In addition: Warning message: In FUN(X[[i]], ...) : first element used of 'length.out' argument
Please help.
Thanks Akhil
-
OzanStats almost 6 yearsHey Akhil, the community would be much more helpful if you could make your question reproducible.
-