tags:

views:

44

answers:

2

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!

A: 

It's installed as "power" not "pwr". Problem solved..:)

Brian
+2  A: 

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.

Gavin Simpson