R - trouble loading "forecast" package - r

When trying to load the "forecast" package in R using
library(forecast)
I get the pop-up error message: "The procedure entry point IdnToAscii could not be located in the dynamic link library KERNEL32.dll".
This is then followed by an error message in the console: "unable to load shared object 'C:/Documents and Settings/hq/My Documents/R/win-library/3.3/curl/libs/i386/curl.dll':
LoadLibrary failure: The specified procedure could not be found."
From the research I've done on this, it looks as though this problem is occurring because R is having difficulty with that specific library location. So I've re-installed "forecast", using a different location:
library(forecast,lib.loc="C:/Documents and Settings/hq/Desktop/RDirectory/New Library")
I have checked, and the files are now in that second location. However, when I do:
library(forecast,lib.loc="C:/Documents and Settings/hq/Desktop/RDirectory/New Library")
I get the same pop-up error message, followed by the same error message in the console: "Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Documents and Settings/hq/My Documents/R/win-library/3.3/curl/libs/i386/curl.dll':". This suggests that R is ignoring my instruction to look in a different library location, and going back to the same location.
Apologies - I'm sure this is a very basic question, but I've never used R before.
Update - I wanted to check that this wasn't a generic problem with downloading packages from R, so I have installed another package (e1071) at random and run a random function from that package (the "naiveBayes" function), and this installed, loaded and ran perfectly. This suggests that this is perhaps something to do with the installation of this specific package.
Update 2 - just changed the library location. Made absolutely no difference. I am using Windows XP and R version 3.3.0, if either of these is relevant...

Related

Unable to load any packages in R after installing rtools because "package 'stats' does not have a namespace"

Earlier today I was trying to install a package from github using the library_github command from the devtools package. However, I received an error that devtools could not be used because rtools was not installed. I tried to install rtools using the notation described directly by https://cran.r-project.org/ to install rtools for Windows 10 device. However, this never worked. I went down a rabbit hole of trying to google how to setup rtools with R that led me to uninstall, redownload R, R-Studio, and R-Tools several times. I don't remember all that I tried, but I do remember the 2 main things which I will list below.
1.
The computer I am using is a Windows PC that is less than 4 months old, so much of my work up to this point has been automatically saved by Microsoft on their free Onedrive trial. I never paid much mind to it and didn't even realize all of my work and Internet downloads including my original setup of R and R-Studio had been saved on
OneDrive. This hadn't been an issue until recently when my free trial space on Microsoft OneDrive ran out. As a part of this process I went and tried to move everything off of OneDrive onto my computer's hard drive. A part of this included routing my packages that I would install in R onto a folder on my hard drive as is illustrated in this link: https://medium.com/#ValidScience/how-to-fix-rstudios-package-installation-on-windows-10-c1e602bf3a1f. So while I don't think that my current installation of R is tied at all to OneDrive, I have linked my installations in R to another folder on my hard drive called RFolder.
2.
When initially trying to install Rtools onto R I copied pretty much everything that this user illustrated in this video: https://www.youtube.com/watch?v=njZBf34Akgo After I completed the steps in this video, I first began to see issues with R-Studio being unable to access the stats file in R. I also began to get this error code every time that I opened R:
During startup - Warning message:
package ‘stats’ in options("defaultPackages") was not found
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Program Files/R/R-4.1.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
[Workspace loaded from ~/.RData]
When I googled this issue of LoadLibrary failure I was led to this thread https://community.rstudio.com/t/stat-package-will-not-load-after-installing-rtools/63265/11 where a user specifies a solution about deleting a hidden "./Renviron" file. I don't understand this at all and can't seem to find this file anywhere on my computer.
I have tried the simple solution of just deleting R, R-Studio, and RTools from the computer several times. However, even when I only redownload R and R-Studio and try to and try to get them to work, I am met with this same error. As it stands, I can no longer do anything in R because I cannot load any packages. I am able to install packages, but every time I try to use them with the library command I get this error:
Error: package or namespace load failed for ‘tidyverse’ in inDL(x, as.logical(local), as.logical(now), ...):
unable to load shared object 'C:/Program Files/R/R-4.1.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
Any ideas on how to fix these issues would be greatly appreciated.

R: stats package functions such as rnorm() and runif() do not work

After updating R, I found that some functions like rnorm() and runif() were not working. Functions don't work not only in my code, but even the simplest examples like rnorm(100, mean = 5, sd = 2). R writes that can't find the function "rnorm". Everything else works. What does this mean? These are standard functions of the Stats package, I can't install or reinstall it. What could be the problem?
When loading, R gives a message about the problem:
"Error: package or namespace load failed for ‘stats’ in inDL(x, as.logical(local), as.logical(now), ...):
can't load shared object 'C:/Program Files/R/R-4.0.2/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module was not found."
I use the latest version of Windows 10, my current version of R is 4.0.2. I installed R 4.0.3, but the problem remained
I had the same issue as you, but deleting temporary RStudio files did not fix it for me. I found that my PATH variable was incorrect, and when I updated it my base packages were working again. The Sys.getenv("PATH") function will tell you where your current PATH variable is set to, which should be wherever you have installed R. For whatever reason, my PATH was set to C:\\rtools40\\usr\\bin but, for me, should be C:\Program Files\R\R-4.0.3\bin\x64. I updated the PATH with Sys.setenv(PATH="C:/Program Files/R/R-4.0.3/bin/x64") and that fixed it for me.
It seems that the problem was not with R, but with RStudio. I installed a fresh version of R, but the problem remained. This was already suspicious. The error that was displayed in the R Studio console indicated a problem with a specific library, but it was still not R itself, but with RStudio. I decided to check what would happen if I ran the same command in pure R. The command worked normally, so everything was fine with R itself and its libraries. I deleted the temporary files of RStudio and after that everything started running normally in it.

I am trying to load the tidyverse library, but I am getting an error message

First time using R, very new to coding. I'm trying to open the tidyverse library (I think that's the correct terminology) and I keep getting this error code:
> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in inDL(x, as.logical(local), as.logical(now), ...):
unable to load shared object 'C:/Users/(myusername)/Documents/R/win-library/4.0/Rcpp/libs/x64/Rcpp.dll':
LoadLibrary failure: The specified procedure could not be found.
In addition: Warning message:
package ‘tidyverse’ was built under R version 4.0.2
I have updated my Rstudio by pressing the "Update" button under the Packages tab, but I don't think that's working, or what is causing the issue. Is the problem that I have a "shared object" in the wrong folder, or do I need an updated version of tidyverse? Or potentially something else? Thanks for the help.
The whole problem lies in the system version of R and Rstudio. I have in my computer home 64 bit system. I have installed the new version of R 4.0.2 and Rstudio 1.3... (64 bit). I run install.packages("tidyverse") everythings looks good. However, in my computer at office I have system version 32 bit. I does not work even I installed the new version of R 4.0.2. but I still have Rstudio older version.

Error: package or namespace load failed for �shiny�: When Deploying Shiny App

I am trying to deploy a shiny app onto shinyapps.io but I get the following output in Deploy tab:
Error: package or namespace load failed for �shiny�:
.onLoad failed in loadNamespace() for 'shiny', details:
call: .Call("_httpuv_getRNGState", PACKAGE = "httpuv")
error: "_httpuv_getRNGState" not available for .Call() for package "httpuv"
Error: loading failed
Execution halted
The app I am trying to deploy is the template/draft app you get when you start a new shiny web app file from RStudio. At first I thought the cause of the error might be something in my original apps that I tried to upload.
Would anyone be able to assist in fixing or at least explaining what might be causing the error.
I don't have enough reputation points to just leave a comment, but if you search Google for your error lots of information comes up (i.e. here or here). It appears to be either an error with the install of httpuv or one of the packages it is linked to (such as Rcpp or later), so update those packages and see if that works.

Error: could not find function "geom_sf"

I'm currently running R version 3.4.2 on Windows and have ggplot2 (via tidyverse) and sf package versions 3.4.2. I'm attempting to map spatial data using the ggplot2 sf kit.
When trying to run geom_sf, I receive an error: could not find function "geom_sf".
When I search the ggplot2 package using ls("package:ggplot2"), geom_sf is not listed in the library files.
I installed devtools and ran devtools::install_github("tidyverse/ggplot2"). However, I receive an error: Installation failed: Failed to connect to raw.githubusercontent.come port 443: Timed out. I assume the firewall at work is halting this connection.
To get around this, I tried downloading the zip manually from https://github.com/tidyverse/ggplot2 and running install.packages('ggplot2-master.zip', lib = 'C:/filepath') and receive the error: package 'ggplot2-master.zip' is not available (for R version 3.4.2). I was getting the same error before I updated from 3.4.1.
TLDR: I'm having the same issue as this user: Error when plotting sf object --- Error: could not find function "geom_sf"
but the solution does not work for me.
Does anyone see where I may be missing something? Or how to access this highly referenced (more streamlined) package?
If you downloaded from the URL you cited then the appropriate next step would be to execute this at the R session command line assuming your package is in the working directory:
install.packages('ggplot2', repo=NULL, lib = 'C:/filepath')
The .zip extension is implicit in trying to install from a binary windows file and you need to tell it NOT to attempt downloading from CRAN.

Resources