Unable to install conrib.url - r

I'm having trouble installing the contrib.url package in my RStudio on Windows. Please note that I am using the latest version of RStudio.
I have tried different means via resources I got online and from the R online community but I keep getting this error message:
"A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages"
I noticed I need this package because I am unable to knit my .Rmd files in HTML and PDF. I was advised to install tinytex and contrib.url. I have been able to install tinytex but couldn't get a way around installing contrib.url.

contrib.url is not an R package:
any(grepl("contrib.url", available.packages()))
[1] FALSE
It is a function from the utils package, though (which comes pre-installed):
?contrib.url
It can be used to specify the package type for repository URLs.

I have been able to knit the .Rmd file now to HTML. All I needed to do was to just comment out the install.packages() function before knitting and it was successful. Thanks all for your help!

Related

How to fix error: package 'tzdb' is not available for this version of R

I'm new at R and trying to usetidyverse. The installation seems to go fine, but when I want to load the package, I get this error: there is no package called 'tzdb'. When I try to install 'tzdb' I get a warning that package 'tzdb' is not available for this version of R. I'm using version 4.0.5, which I believe should work.
Any suggestions on how I can get this package to work (so I can start using tidyverse)?
Edit: I've added an image of the code I ran + the outputs of sessionInfo() , options("repos") and .libPaths() below. (I'm sorry I can't copy paste code nor use the browser of the virtual machine that I work from).
https://i.stack.imgur.com/hra1r.png
It does give a warning stating that the CRAN mirror is set to an insecure URL. Could that be the problem? It didnt't seem matter for the other packages.

Install R packages problem using RStudio Package Manager

I tried to install R packages using RStudio Package Manager using the following code:
install.packages("dplyr", type = "source")
and
install.packages("dplyr")
and it gives the following error:
Error in install.packages : invalid version specification 'r56550'
What should I do? I tried to google the error but nothing comes up. I have tried to delete and reinstall R and RStudio but i still received the error. I tried to download both the existing binary and the source file and neither ways worked. I tried to install different packages and repeated in both R and Rstudio and nothing worked.
Thank you!
Update 1: I'm using R version 4.0.5 and RStudio version 1.4.1106. I have also downloaded Rtools40 according to the instruction in the following website: https://cran.r-project.org/bin/windows/Rtools/. I'm using Windows. By 'R Manager' I meant the package manager console in RStudio.
Update 2: I'm not sure if there is no network issue or proxy. If I download the packages directly through the CRAN mirror, then it works. But we are trying to download packages in an offline environment, that's why I need RStudio Package Manager.

Can I add additional R packages to Overleaf?

Is there any way to add packages that knitr doesn't know? I use knitr in Overleaf, and I need to use packages "pacma", "nonlinearTseries" and "RHRV". But when I tried to install them it didn't work.
I tried do add them with library function but it get me an error massage.
library("RHRV")
Error in library("RHRV"): there is no package called ’RHRV’
Unfortunately, installing a package on Overleaf is not possible, see e.g. https://tex.stackexchange.com/questions/566054/cannot-install-r-packages-in-the-knitr-environment-overleaf
You could try to contact the team behind Overleaf and ask them politely, but they can have reasons why they cannot help you.
As Overleaf is simply a TeX distribution and compiliation, with some R thrown into it, you you could consider installing R locally. Installing a TeX distribution can be more overwhelming than installing a operating system. Luckily, for knitr, the author behind made an R-package, tinytex (https://yihui.org/tinytex/) - which does almost everything for you.

r package installed properly but "there is no package called ‘DiabetesTxPath-master" error

I'm trying to install a package called "DiabetesTxPath-master" from local files.(The file can be downloaded in https://github.com/rohit43/DiabetesTxPath)
I used the code below installing it.
'filename<-"DiabetesTxPath-master.zip"'
install.packages(filename,type="binary",repos=NULL)
but when I try to load the packaged by the code below,
library(DiabetesTxPath)
error comes up.
there is no package called ‘DiabetesTxPath-master'
There is no problem in location.
.libPaths()
[1] "C:/Program Files/R/R-3.4.2/library"'
and this is where I want my package to be installed.
(and I see my packaged installed in the folder with my eyes!)
2.I've also tried to run as an administrator. it didn't work either.
So what could be the probelm, and how could I fix this?
Any comment would be appreciated so much.
I've been trying it so hard for a week.
Try using
library(devtools)
install_github("rohit43/DiabetesTxPath")
the problem arises because the dependencies for this package
ERROR: dependencies 'FeatureExtraction', 'CohortMethod',
'OhdsiSharing' are not available for package 'DiabetesTxPath'
are not available for this package in R 3.5 and above .
Now you need to install older version of R where these dependencies were supported and try using the above method.

Can not Download 'digest' package in R

I am trying to create clustered box plots in R. Everything about my code seems on track, but when I try to run it I get the error warning
"Error in loadNamespace(name) : there is no package called ‘digest’.
When I try to download the package digest in the R package Installer I get a bunch of errors stating that the download of digest failed.
How do I get the digest package, OR is there a way to do clustered box plots without this? Thanks!
I had the same problem with install.packages("digest") on OS10.11.6 (running with the defaults). But it worked by specifying the repos:
install.packages('digest', repos='http://cran.us.r-project.org')
I had a similar error message recently and managed to solve the problem by downloading the tar.gz file directly from the CRAN Repository (see https://cran.r-project.org/web/packages/digest/index.html and download "digest_0.6.15.tar.gz") and then you can install it in RStudio (Tools -> Install Packages -> Install from Package/Archive File).

Resources