Can install, but can't access, the pwr package in R - r

I'm having trouble getting access to the pwr. This is on Ubuntu Lucid Lynx, 64 bit.
I'm installing pwr via packages.install('pwr'), and loading it via library(pwr), both of which appear successful.
Strangely, I never get access to the pwr object in R.
I tried installing it to /usr/local/lib/R/site-library and ~/R/x86_64-pc-linux-gnu-library.
I also tried installing it with R CMD INSTALL pwr.
I have also tried installing it on my mac mini running Leopard but it can't even find the packages object, and CMD INSTALL pwr returns
invalid package 'pwr'
What am I doing wrong? Thanks!

Not quite right. It is installed as "pwr" and loaded as such:
> install.packages("pwr", depend = TRUE)
trying URL 'http://cran.uk.r-project.org/src/contrib/pwr_1.1.1.tar.gz'
Content type 'application/x-gzip' length 7915 bytes
opened URL
==================================================
....
> require(pwr)
Loading required package: pwr
> help(package = "pwr")
The output from the last command there shows that there doesn't appear to be a power() in that package. What you've seen is the power() function in the stats package, one of the packages that comes with R. Try ?power and look at the very top of the help page. It states "package:stats".
Furthermore, packages.install() is not a function that me R knows about. I think you meant install.packages()?
To summarise. Install the packages using this from within R (if you have a net connection):
install.packages("pwr")
Then load the package:
require("pwr")
Then you can start using it.

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.

Can't load geoR package (R, library())

for a project in university, I need to install a package which depends on geoR. Unfortunately, I can't load the package with library(geoR). The installation is not a problem. I've tried to uninstall and install the package and updated R. It still loads "forever". It is particularly strange since I can easily load any other installed package with library(...). Since I don't get any error message in the console, I'm very frustrated and have no idea how to solve that issue. I use Mac OS X 10.14.4. I'm using RStudio Version 1.1.463.
The installation seems to be no problem:
> install.packages("geoR")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/geoR_1.7-5.2.1.tgz'
Content type 'application/x-gzip' length 1544028 bytes (1.5 MB)
==================================================
downloaded 1.5 MB
The downloaded binary packages are in
/var/folders/cn/p44ynxg91mq7_ld8qrllxtx80000gn/T//RtmpGJbn5O/downloaded_packages
> library(geoR)
After the library-call, a never-ending process starts. Is there a way to track the library call? I haven't found any proper solution online. Since it loads forever, the only thing I can do is to force quit R Studio. I've tried to load it in R as well, didn't work either. I've also tried to delete the (installed geoR)-folder manually in library/Frameworks/r.framework/..., it didn't help as well.
Try installing an older version using devtools:
remove.packages("geoR")
install.packages("devtools")
require(devtools)
install_version("geoR", version = "1.7-4.1", repos = "http://cran.r-project.org")
options(gsubfn.engine = "R")
library(geoR, verbose = TRUE)

Installing GIS tools in R

I am trying to download GIStools in R. I did this through the Packages menu > Install Packages. I then selected GIStools and it appears to have installed it as I get the following message:
> utils:::menuInstallPkgs()
trying URL 'https://mirrors.ebi.ac.uk/CRAN/bin/windows/contrib/3.2/GISTools_0.7-4.zip'
Content type 'application/zip' length 3460038 bytes (3.3 MB)
downloaded 3.3 MB
package ‘GISTools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\MachineX\AppData\Local\Temp\RtmpCCEk3L\downloaded_packages
I didn't select a mirror site from which to d/l the package (was it supposed to prompt me?) When I call the library using library(GIStools) I get the following error:
Error in library(GIStools) : there is no package called ‘GIStools’
I'm not sure what I have done wrong - can anyone help? I am using R version 3.2.3. I am totally new to R, so apologies if this seems like a silly question.
Thanks!
in the console type install.packages('GIStools') make sure you are running rstudio as admin when doing this. This should install just fine make sure you don't have the rstudio screen maximized as the mirror prompt could be hidden.

R not finding package even after package installation

I have always worked with the zoo package, that I have installed a long time ago. Today, I created a new R script, and ran library(zoo) and got the following error:
> library(zoo)
Error in library(zoo) : there is no package called ‘zoo’
Odd.. Still, I tried reinstalling the package using install.packages("zoo"), and get the following:
> install.packages("zoo")
Installing package(s) into ‘C:/Users/U122337.BOSTONADVISORS/Documents/R/win-library/2.15’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.15/zoo_1.7-10.zip'
Content type 'application/zip' length 874474 bytes (853 Kb)
opened URL
downloaded 853 Kb
package ‘zoo’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘zoo’
The downloaded binary packages are in
C:\Users\U122337.BOSTONADVISORS\AppData\Local\Temp\Rtmp404t8Y\downloaded_packages
When I try uploading the package, I get the error again that the zoo package doesn't exist.
I have no idea what's happening. I exited the GUI and restarted it, same problem. I have always worked with this package, and I have no idea why this is happening now.
Do .libPaths(), close every R runing, check in the first directory, remove the zoo package restart R and install zoo again. Of course you need to have sufficient rights.
When you run
install.packages("whatever")
you got message that your binaries are downloaded into temporary location (e.g. The downloaded binary packages are in
C:\Users\User_name\AppData\Local\Temp\RtmpC6Y8Yv\downloaded_packages ). Go there. Take binaries (zip file). Copy paste into location which you get from running the code:
.libPaths()
If libPaths shows 2 locations, then paste into second one. Load library:
library(whatever)
Fixed.
I had this problem and the issue was that I had the package loaded in another R instance. Simply closing all R instances and installing on a fresh instance allowed for the package to be installed.
Generally, you can also install if every remaining instance has never loaded the package as well (even if it installed an old version).
So the package will be downloaded in a temp folder C:\Users\U122337.BOSTONADVISORS\AppData\Local\Temp\Rtmp404t8Y\downloaded_packages from where it will be installed into your library folder, e.g. C:\R\library\zoo
What you have to do once install command is done: Open Packages menu -> Load package...
You will see your package on the list. You can automate this:
How to load packages in R automatically?
go to this folder C:\Users\hp\Documents\R\win-library\4.0 in your PC.
And delete '00LOCK' named folder.
then It will work properly, THis folder is being locked all incoming file.IF your delete this , then it will work.

Error while installing R package: package built for universal-apple-darwin

I installed a R package as suggested by How do I install an R package from source?, using R CMD INSTALL [my_pkg_path.tgz]. Package sources are downloaded from r-project.org, e.g., http://cran.r-project.org/web/packages/fields/index.html
However, when I try to load the package using say library(fields), I got the error that complains the package are built for universal-apple-darwin:
Error: package ‘fields’ was built for universal-apple-darwin9.8.0
Guess it's something to do with architecture, but no idea how to resolve it. Any idea? Thanks.
It looks like you downloaded the package's Mac OSX binary file, which usually ends in .tgz - try downloading the package source (usually something ending in .tar.gz) and installing the package again.
Depending on what your operating system is, you may need an additional set of software before you can install packages from source. If the above suggestion doesn't work, would you provide some information about the OS, for example from sessionInfo()?

Resources