DistanceDevelopment / distance-bugs

A place to keep bugs in Distance
http://distancesampling.org/Distance
1 stars 0 forks source link

install.distance.packages failure in support.r #155

Open dfifield opened 8 years ago

dfifield commented 8 years ago

I was attempting to use the mrds engine through the Distance 6.2R1 user interface. This was a "fresh" machine belonging to a friend with no mrds R package installed.

I got the following error message in the log:

source('C:\Program Files (x86)\Distance 6\support.r') source('C:\Program Files (x86)\Distance 6\mrds.support.r') install.distance.packages(dir='C:\Program Files (x86)\Distance 6\RPackages\') Attempting to install: mrds Installing package into 'C:/Users/fifieldd/Documents/R/win-library/3.2' (as 'lib' is unspecified) Error in install.packages(paste(dir, "\", file.name, sep = ""), repos = repos, : type == "both" cannot be used with 'repos = NULL' Calls: install.distance.packages -> install.packages Execution halted

I tracked it down to line 67 in support.r:

install.packages(paste(dir,"\",file.name,sep=""),repos=repos)

Unfortunately, the R installation on this machine has getOption("pkgType") == "both", which causes install.packages to choke.

My solution was to change line 67 in support.r to: install.packages(paste(dir,"\",file.name,sep=""),repos=repos, type = "win.binary")

However, I realize this is a wholly Windows-centric fix!

Cheers,

Dave

Dave Fifield dave.fifield@ec.gc.ca

dill commented 8 years ago

Hi Dave, have you tried installing with R 3.1? This version of Distance is only tested with R 3.1 and I believe this problem might well be down to a change in R. On Windows one can have multiple versions of R installed (I believe) so there shouldn't be an issue in having both 3.1 and 3.2 on the machine.

Please do post again here if it works or not. Thanks!

dfifield commented 8 years ago

Yes, you're right, it does work in 3.1. The difference is that in 3.1 the default value for option "pkgType" is "win.binary" whereas in 3.2 it is "both" and as mentioned my original post, install.packages chokes when repos == NULL, type == "both". You will no doubt run into this when you test Distance under R 3.2.

Cheers, Dave