开发者

R help - why can't I download the nortest package on my work computer?

开发者 https://www.devze.com 2023-03-06 16:48 出处:网络
I need to use R to do some stats at work. The problem is, when I try and download the nortest package, using the following function:

I need to use R to do some stats at work. The problem is, when I try and download the nortest package, using the following function:

install.packages("nortest")

Or by selecting 'install packages' from the R menu (NB.: I am using a UK CRAN mirror), I get the following error message:

Error in read.dcf(file = tmpf) : 
  Line starting '<head><title> ...' is malformed!

I spoke to the IT dept at work and they mentioned that because R is ope开发者_Python百科n source, there are blocks on downloading certain things - and we ran a check and the system was blocking my download of nortest, for security reasons. The IT guy did say he wouldn't mind lowering the block just once, if I could then save the (zip?) file so I didn't need to access the internet every time I loaded up the package.

The problem is, I have no idea how to get a copy of 'nortest' as a zip file. And then once I have it, I don't know how to save it so that it loads from a saved file rather than selecting 'install package' from the R menu.

Any help would be very much appreciated.

Thanks,

Kate


If you're on Windows, try using setInternet2 so that your IT network thinks that it is Internet Explorer connecting to the internet. Often useful for evading corporate lockdown.


Ask your site IT to add an exception to their firewall/content blocking for this CRAN mirror, or download it elsewhere and transfer the file to where you need it:

http://www.stats.bris.ac.uk/R/web/packages/nortest/index.html


At first, you should know, that if you have installed the package you don't need to download it again (unless you delete it purposefully from your R folder). just load it with require(nortest) and it will fetch it from your hard drive. So you could go with the just once solution provided by your IT guys.

However, there will always be other interesting packages, e.g. (for me): stringr, reshape, ez, ...
So you will need a permanent solution.

If it does not work with setInternet2 as Richie Cotton suggested there is another way of getting packages.

You can download the zip files directly from the web page on cran. For nortest the direct link to the zip is the following: http://cran.r-project.org/bin/windows/contrib/r-release/nortest_1.0.zip
Then, you need to change the working directory of r (see ?getwd ans ?setwd) to the directory that contains the zip file and install it directly from your harddrive within R with:

install.packages("nortest_1.0.zip", repos = NULL)

This works for any package with the correct file name.

0

精彩评论

暂无评论...
验证码 换一张
取 消