Problem in RStudio with the dplyr package - r

Every time I try to load a package using library(dplyr) it gives me this error
message error: there is no package called ‘crayon’
I'm not sure what to do I have installed the packages.

You might also try installing another package that includes dplyr (like tidyverse) https://www.tidyverse.org/packages/
install.packages("tidyverse")
library(tidyverse)

Related

I tried do install tidyversepackage and received the message

> library(tidyverse)
Error in library(tidyverse) : there is no package called ‘tidyverse’
I tried to configure R Studio
library(tidyverse) is for loading the package after installation. For you to install the package run install.packages("tidyverse")

How do I go about resolving "package ‘ddply’ is not available (for R version 3.6.2)"

I'm trying to install the package "ddply" but keep getting this response
install.packages("ddply")
Warning in install.packages :
package ‘ddply’ is not available (for R version 3.6.2)
Any ideas on how to fix this?
The ddply is a function from the plyr package. So, if we install the plyr package, it would work
install.packages('plyr')

ggplot2 fails to load, with 'rlang' package error

This is the error message:
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.3.4 is already loaded, but >= 0.4.0 is required
In addition to a Warning message:
package ‘ggplot2’ was built under R version 3.6.1
Please help. Thanks a lot.
Just providing a more complete answer for people to follow.
Remove packages with
remove.packages("rlang")
That may not work as you may need to delete the package from your R library. To find where you R library is run
.libPaths()
Once you've deleted the rlang folder from there you can restart R and run
install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.4.9.tar.gz", repo=NULL, type="source") # for specific rlang version, in this case 0.4.9. For latest version can run install.packages("rlang")
packageVersion("rlang") #to check you now have rlang version you want
Figured just a slight modification to the first answer worked best for me:
restart R, then:
remove.packages("rlang")
remove.packages("dplyr")
install.packages("rlang")
install.packages("dplyr")
library(rlang)
library(dplyr)
My solution is to restart R and then update all the packages.
update.packages(ask = FALSE)
The problem with just removing & installing rlang, and then your desired package (here ggplot2), you might find there are other packages you have remove and install. Best to update all and save time.
Problem solved by updating the R and Rstudio, removing "rlang" package and reinstalling the package, removing "ggplot2" package and reinstalling the package back.
Just update your R package, because there is a new update in the ggplot2 package which supports the higher R ver, it should be 3.6.3 and greater !

Failing to install Kieran Healy's 'socviz' package from github using devtools

I am trying to follow along with the online data viz resource by Kieran Healy (socviz.co), and have had minimal trouble setting things up to do so. I cannot seem to successfully install his 'socviz' package. This is the code Healy suggests:
devtools::install_github('kjhealy/socviz')
This returns:
ERROR: dependency 'rlang' is not available for package 'socviz'
* removing 'C:/Users/annem/OneDrive/Documents/R/win-library/3.4/socviz'
Installation failed: Command failed (1)
I tried removing and reinstalling 'rlang', but I still received the same error. I have also tried restarting R.
When reinstalling 'rlang', I get the following:
package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘rlang’
And when trying to load:
library(rlang)
Error in library(rlang) : there is no package called ‘rlang’
I'm using R v 3.4.2 on Windows 10.
I'm relatively new to R, so if there's a seemingly obvious solution (or you think it could be solved by doing something I've already done) let me know!
It's very possible I'm making a silly mistake, but I haven't found it myself. Any help is appreciated!
Turns out the problem was in how I was removing 'rlang'. I was attempting to using remove.packages() while the package was loaded into my session. I deleted it from my machine directly, but as Tung mentioned, using the remove.packages() command works as long as it is not loaded into the current R session.
Lesson learned--thanks!

Error: package 'DBI' required by 'AnnotationDbi' could not be found in R(v 2.7.0)

I install old version of R (windows version 2.7.0).
For using bioconductor in R, use source("http://bioconductor.org/getBioC.R")
biocLite("GO.db")
library("GO.db")
When I load GO.db, it gives error:
Loading required package: AnnotationDbi
Error: package 'DBI' required by 'AnnotationDbi' could not be found
How can I solve this problem? Please Help.
R packages are often require or depend upon other packages. For example, GO.db requires AnnotationDbi. When a package in Bioconductor requires another Bioconductor package, it will usually just install both of them at the same time.
Unfortunately, there are times when a package from Bioconductor requires a package from CRAN, and you will need to install each package separately. In this case, DBI is required by AnnotationDbi, but it is on CRAN.
Try installing DBI:
install.packages("DBI")
Then try loading GO.db. You may have to re-install AnnotationDbi again to get it to work.

Resources