Problem installing/loading tidyverse package on Windows computer

I am fairly new to R and have been completing the Swirl course to better my basic understanding. When moving onto the intermediate lessons I encountered a problem downloading the tidyverse package. I first of all downloaded Rtools using:

writeLines('PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"', con = "~/.Renviron"

to compile the package properly. I have tried using:


install.packages("tidyverse", dependencies = TRUE)

I have done this multiple times and get this code message:

Installing package into ‘C:/Users/lmck0/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified) trying URL '' Content type 'application/zip' length 439983 bytes (429 KB) downloaded 429 KB

package ‘tidyverse’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\lmck0\AppData\Local\Temp\RtmpY5tVDF\downloaded_packages

I then use library(tidyverse) and get this code message:

Error: package or namespace load failed for ‘tidyverse’: .onAttach failed in attachNamespace() for 'tidyverse', details: call: namespaceExport(ns, exports) error: undefined exports: addTheme, applyTheme, as.document_position, as.document_range, askForPassword, askForSecret, bugReport, buildToolsCheck, buildToolsExec, buildToolsInstall, callFun, convertTheme, createProjectTemplate, dictionariesPath, documentClose, documentNew, documentSave, documentSaveAll, document_position, document_range, executeCommand, findFun, getActiveDocumentContext, getActiveProject, getConsoleEditorContext, getPersistentValue, getRStudioPackageDependencies, getSourceEditorContext, getThemeInfo, getThemes, getVersion, hasColorConsole, hasFun, highlightUi, initializeProject, insertText, is.document_position, is.document_range, isAvailable, jobAdd, jobAddOutput, jobAddProgress, jobRemove, jobRunScript, jobSetProgress, jobSetState, jobSetStatus, launcherAvailable, launcherConfig, launcherContainer, launcherC In addition: Warning messages: 1: S3 methods ‘as.document_position.default’, ‘as.document_position.document_position’, ‘as.document_range.default’, ‘as.document_range.document_range’, ‘format.document_position’, ‘format.document_range’, ‘primary_selection.document_context’, ‘primary_selection.document_selection’, ‘print.document_context’, ‘print.document_position’, ‘print.document_range’, ‘print.document_selection’ were declared in NAMESPACE but not found 2: S3 methods ‘as.document_position.default’, ‘as.document_position.document_position’, ‘as.document_range.default’, ‘as.document_range.document_range’, ‘format.document_position’, ‘format.document_range’, ‘primary_selection.document_context’, ‘primary_selection.document_selection’, ‘print.document_context’, ‘print.document_position’, ‘print.document_range’, ‘print.document_selection’ were declared in NAMESPACE but not found 3: S3 methods ‘as.document_position.default’, ‘as.document_position.document_position’, ‘as.document_range.default’, ‘as.document_range.document_range’, ‘format.document_position’, ‘format.document_range’, ‘primary_selection.document_context’, ‘primary_selection.document_selection’, ‘print.document_context’, ‘print.document_position’, ‘print.document_range’, ‘print.document_selection’ were declared in NAMESPACE but not found

I have also tried uninstalling Rstudio and Rtools and reinstalling them multiple times as well and nothing seems to be working and I am unable to continue with the Swirl course.

I was just wondering if anyone had run into the same problems or if I am missing something...

Any help would be much appreciated!

The package library is independent from these two software, I recommend you to uninstall (or manually remove) tidyverse, restart your R session and try to install again.

[quote="lmck0705, post:1, topic:68273"]
I first of all downloaded Rtools using:
writeLines('PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"', con = "~/.Renviron"

Not sure if this is relevant to you or not but I want to clariify that the writeLines() will not download anything, rather it edits your .Renviron to contain the text about the RTOOLS40 path. Yet, I think this might not be relevant as since you are a windows user install.packages seems to have succesfully downloaded a binary ,and therefore wouldnt need Rtools to compile from source.

Weirdly the list of exports mentioned when you use library() seem to all be from the rstudioapi package which would be a part of your Rstudio, very strange.

can you do rstudioapi::getVersion() and also sessionInfo() in your console of Rstudio, and get back to us with the results ?


I ended up solving the issue by closing and re-opening Rstudio, followed by:
install.packages(“rstudioapi”), before installing and reloading tidyverse again!

Thanks for your help.

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