New Error when Using tidyr::spread function in R

Good afternoon!

I have run into a new error, which seems to not have been solved yet (at least, I couldn't find a resolution). I am running some tests on a simple dataframe, and when I attempt to spread the data by the object, I get the following error:

Error in if (n > 2^31) { : missing value where TRUE/FALSE needed

I have no if else loops, nor NAs in the data. I read somewhere I might have something to do with my windows version, but I'm not sure.

Thank you!

Hi, welcome!

We don't really have enough info to help you out. Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

1 Like


I was able to figure it out by creating a new dataframe with the same information from my previous one. I believe it might have been an issue with the sequential use of leftjoin and subset, but I'm not quite sure.

However, the fix of creating a new dataframe using cbind and renaming the columns seems to work.

Thank you so much for the quick answer!

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.