1

I am having few problems with using some specific R functions in Jupiter notebook. All my R code works perfectly until I am trying to use "new" functions, such as pivot_longer() (from tidyr package) and fct_lump_min(from forcats package). This is the error I am getting:

Error in pivot_longer(., everything(), names_to = "variables", values_to = "num_levels"): could not find function "pivot_longer" Traceback:

  1. ramen_data_factor %>% summarise_all(nlevels) %>% pivot_longer(everything(), . names_to = "variables", values_to = "num_levels")
  2. withVisible(eval(quote(_fseq(_lhs)), env, env))
  3. eval(quote(_fseq(_lhs)), env, env)
  4. eval(quote(_fseq(_lhs)), env, env)
  5. _fseq(_lhs)
  6. freduce(value, _function_list)
  7. withVisible(function_list[k])
  8. function_list[k]

However, their "old"correspondent functions, such as gather() and fct_lump() work fine! Also, all the other functions from these Tidyverse packages work (indeed all the libraries are correctly loaded). Since this is the material for a course, I really would like to use the new functions and not the deprecated ones. Does this happens to everybody or should I make some adjustment in my Anaconda distributions settings?

Thanks a lot!

  • You need install a newer version of `tidyr` to get access to `pivot_longer`. You can follow the advice [here](https://stackoverflow.com/questions/34705917/conda-how-to-install-r-packages-that-are-not-available-in-r-essentials) on how to install or update R packages in conda. – caldwellst Apr 28 '20 at 13:49
  • Thanks a lot! Indeed, the solutions look very promising, but I don't have an R library in the folder Anaconda3. So I think I made some mistakes when i created the r-env in Anaconda. – Cristina C. Apr 28 '20 at 14:27

0 Answers0