Having an issue with sorting data in rows due to a conversion error

Hi @LanceAki1 ,

Welcome to the RStudio Community! :wave:

First off, I'd like to introduce the concept of a reproducible example. A reproducible example (or "reprex" for short) is the minimum amount of data and code needed to reproduce the error. Please read more on how to produce a reprex.

Second, aside from the reproducible example please pose a direct question to answer. This will help the community understand what it is you are trying to solve.

Now from what I can discern from some of the code is that there is an error while trying to use the uncount function from tidyr. If this is the error to solve in this post, I thing the problem is that the OS_2010 variable isn't saved in the df dataset. It has simply been printed in a temporary visual in the console in the previous couple steps prior to the error.

I think the uncount() function here is unable to use a variable that technically doesn't exist. Try passing the creation of the OS_2010 variable into a new dataset like so:

# create the new dataset
new_df <- df %<>%
  mutate(OS_2010 = 2010-01 * 100) %>%
  select(MobileOS, OS_2010) %>%
  print()

# then call your new dataset when using the uncount
another_df <- new_df %>%
  uncount(OS_2010) %>%
  print()