some tidyverse commands not loaded despite (apparently) successful run of library(tidyverse)

Hi, I was teaching my students about the benefits of lengthening or widening tables for use with ggplot(), and discovered that several of my students didn't have access to the pivot_longer() command from the tidyr package.

I had one of them run library(tidyverse) in a new RStudio session while I did the same, and their messages showed the same version numbers as mine:

library(tidyverse)
#> ── Attaching packages ────────────────────────────────── tidyverse 1.3.0 ──
#> ✔ ggplot2 3.2.1     ✔ purrr   0.3.3
#> ✔ tibble  2.1.3     ✔ dplyr   0.8.3
#> ✔ tidyr   1.0.0     ✔ stringr 1.4.0
#> ✔ readr   1.3.1     ✔ forcats 0.4.0
#> ── Conflicts ───────────────────────────────────── tidyverse_conflicts() ──
#> ✖ dplyr::filter() masks stats::filter()
#> ✖ dplyr::lag()    masks stats::lag()

Created on 2020-02-19 by the reprex package (v0.3.0)

(I'm on a Mac, the student was on a Windows machine.)

What could explain the missing command(s?)?

Thanks,
David Romano

very bizarre if indeed their tidyr version was listed as 1.0.0 and then they couldnt use the functions...
Was there a specific error encountered?

If you have access to the machine, you can run

lsf.str("package:tidyr")

to get a big alphabetic listing of the functions exposed in the package. pivot_longer should be in there.

Thanks, Nir: There were no errors other than the usual 'not found' error, and it happened to multiple students (although I only checked the one of their machines). I'm not with the student now, but will ask them to run lsf.str() as you suggest and report back with the output, so more soon...

Also, you can try running qualified import (tidyr::pivot_longer() etc.) to see if that helps. But it does sound extremely odd to have this happen only to some students.

No sign of either pivot_* command in the output of lsf.str("package:tidyr") -- the output from one student is below in case it's helpful, but I'm not sure what the next step in trouble-shooting this might be.
Any thoughts?

> lsf.str("package:tidyr")
%>% : function (lhs, rhs)  
complete : function (data, ..., fill = list())  
complete_ : function (data, cols, fill = list(), ...)  
crossing : function (...)  
crossing_ : function (x)  
drop_na : function (data, ...)  
drop_na_ : function (data, vars)  
expand : function (data, ...)  
expand_ : function (data, dots, ...)  
extract : function (data, col, into, regex = "([[:alnum:]]+)", remove = TRUE, convert = FALSE, ...)  
extract_ : function (data, col, into, regex = "([[:alnum:]]+)", remove = TRUE, convert = FALSE, ...)  
extract_numeric : function (x)  
fill : function (data, ..., .direction = c("down", "up"))  
fill_ : function (data, fill_cols, .direction = c("down", "up"))  
full_seq : function (x, period, tol = 1e-06)  
gather : function (data, key = "key", value = "value", ..., na.rm = FALSE, convert = FALSE, factor_key = FALSE)  
gather_ : function (data, key_col, value_col, gather_cols, na.rm = FALSE, convert = FALSE, factor_key = FALSE)  
nest : function (data, ..., .key = "data")  
nest_ : function (data, key_col, nest_cols = character())  
nesting : function (...)  
nesting_ : function (x)  
replace_na : function (data, replace, ...)  
separate : function (data, col, into, sep = "[^[:alnum:]]+", remove = TRUE, convert = FALSE, extra = "warn", fill = "warn", 
    ...)  
separate_ : function (data, col, into, sep = "[^[:alnum:]]+", remove = TRUE, convert = FALSE, extra = "warn", fill = "warn", 
    ...)  
separate_rows : function (data, ..., sep = "[^[:alnum:].]+", convert = FALSE)  
separate_rows_ : function (data, cols, sep = "[^[:alnum:].]+", convert = FALSE)  
spread : function (data, key, value, fill = NA, convert = FALSE, drop = TRUE, sep = NULL)  
spread_ : function (data, key_col, value_col, fill = NA, convert = FALSE, drop = TRUE, sep = NULL)  
uncount : function (data, weights, .remove = TRUE, .id = NULL)  
unite : function (data, col, ..., sep = "_", remove = TRUE)  
unite_ : function (data, col, from, sep = "_", remove = TRUE)  
unnest : function (data, ..., .drop = NA, .id = NULL, .sep = NULL, .preserve = NULL)  
unnest_ : function (data, unnest_cols, .drop = NA, .id = NULL, .sep = NULL, .preserve = NULL)
1 Like

I would be very surprised if they actually have tidyr v1.0.0 and not previous version.

2 Likes

I just checked with one of the students, and that could very well be the issue, so thank you! Now I have to check with the student who I thought had v1.0.0 and see if I mis-saw when we checked versions side by side.

Your suspicions confirmed so far, Misha -- thanks again.

1 Like

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