I am having a rather tough time with the fields package.
sessioninfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
form the url everything seems to be fine and fields
depends on > or = to 3.0
I have tried downloading the package with install.packages
but I get a rather strange result i have not seen before:
trying URL 'http://cran.ma.imperial.ac.uk/bin/macosx/mavericks/contrib/3.1/fields_7.1.tgz'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'http://cran.ma.imperial.ac.uk/bin/macosx/mavericks/contrib/3.1/fields_7.1.tgz'
In addition: Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
cannot open: HTTP status was '404 Not Found'
Warning in download.packages(pkgs, destdir = tmpd, available = available, :
download of package ‘fields’ failed
I have also tried downloading using the url for the files directly for both 7.1
and 6.9.1(mavericks)
:
packageurl <- "http://cran.r-project.org/bin/macosx/mavericks/contrib/3.1/fields_6.9.1.tgz"
> install.packages(packageurl, contriburl=NULL, type="source")
Warning message:
package ‘http://cran.r-project.org/bin/macosx/mavericks/contrib/3.1/fields_6.9.1.tgz’ is not available (for R version 3.1.0)
> packageurl <- "http://cran.r-project.org/bin/macosx/contrib/3.1/fields_7.1.tgz"
> install.packages(packageurl, contriburl=NULL, type="source")
Warning message:
package ‘http://cran.r-project.org/bin/macosx/contrib/3.1/fields_7.1.tgz’ is not available (for R version 3.1.0)
and running all the .R
files from the unpacked .tar
file
sapply(list.files(pattern="[.]R$", path="........fields/R/", full.names=TRUE), source)
but if I do this then functions do not work e.g.
> rdist(c(1,1))
Error in .Fortran("radbas", PACKAGE = "fields", nd = as.integer(d), x1 = as.double(x1), :
"radbas" not available for .Fortran() for package "fields"
QUESTION - This seems weird that fields is not available for R 3.1 as it is an intensely used package by many, any ideas on solving this?
I had this issue after installing R 3.4.0 for Win 10, 64-bit. Was unable to resolve it, so I rolled back to 3.3.3 and now it works fine again.
Before doing this, I tried deleting the RStudio user settings and the R package library (if the problem was caused by a broken package).
Seems that repository at http://cran.ma.imperial.ac.uk is messed up. There is fields_6.9.1.tgz (you could check it by going to http://cran.ma.imperial.ac.uk/bin/macosx/mavericks/contrib/3.1/fields_6.9.1.tgz), but in PACKAGES
file (which is used by install.packages
to find url of package) there is:
Package: fields Version: 7.1 Title: Tools for spatial data Depends: R (>= 3.0), methods, spam, maps Built: R 3.1.0; x86_64-apple-darwin13.1.0; 2014-05-20 04:58:37 UTC; unix Archs: fields.so.dSYM
That is why you got 404 error.
If you want to install by hand you need to either download file and install from local file or use
# cran got 7.1
packageurl <- "http://cran.r-project.org/bin/macosx/mavericks/contrib/3.1/fields_7.1.tgz"
# your mirror got 6.9.1
packageurl <- "http://cran.ma.imperial.ac.uk/bin/macosx/mavericks/contrib/3.1/fields_6.9.1.tgz"
library(devtools)
install_url(packageurl)
I think this is temporary problem and in some point in time proper file will show up.
Now you can do it with base R:
CHANGES IN R 3.1.1
NEW FEATURES
- install.packages(repos = NULL) now accepts http:// or ftp:// URLs of package archives as well as file paths, and will download as required. In most cases repos = NULL can be deduced from the extension of the URL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With