Closed RS-eco closed 7 years ago
It seems my method of calling zipped data packages from their original source is problematic.
@MalteJochum also had problems with the installation prompting this error message:
* installing *source* package ‘traitdataform’ ...
** R
** data
*** moving datasets to lazyload DB
** preparing package for lazy loading
Warning: replacing previous import by ‘reshape::melt’ when loading ‘traitdataform’
loading dataset 'arthropodtraits' from original data source!
When using this data, please cite the original publication:
Gossner MM, Simons NK, Achtziger R, Blick T, Dorow W, Dziock F, Köhler
F, Rabitsch W and Weisser WW (2015). “A summary of eight traits of
Coleoptera, Hemiptera, Orthoptera and Araneae, occurring in grasslands
in Germany.” _Scientific Data_, *2*, pp. 150013. <URL:
http://doi.org/10.1038/sdata.2015.13>.
Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, numerals = numerals, :
invalid multibyte string at '<b0>57<92><a0>N<a0>10<b0>55<92><a0>E'
Error : unable to load R code in package ‘traitdataform’
ERROR: lazy loading failed for package ‘traitdataform’
* removing ‘/home/malte/R/x86_64-pc-linux-gnu-library/3.2/traitdataform’
Installation failed: Command failed (1)
In Maltes case it could be a Linux incompatibility with the URL provided in R/data.R.
Could you both try to execute the code blocks provided in /R/data.R and see if the demo datasets are loaded into your environment? If any error messages arise, please post them here.
I struggle to download the passerines dataset.
download.file("http://onlinelibrary.wiley.com/store/10.1002/ecy.1783/asset/supinfo/ecy1783-sup-0002-DataS1.zip?v=1&s=361647dd673d04c9b0838931cda1cf28e1f6eb1f", temp, method = "curl", quiet = TRUE)
Error in download.file("http://onlinelibrary.wiley.com/store/10.1002/ecy.1783/asset/supinfo/ecy1783-sup-0002-DataS1.zip?v=1&s=361647dd673d04c9b0838931cda1cf28e1f6eb1f", : 'curl' call had nonzero exit status In addition: Warning message: running command 'curl -s -S "http://onlinelibrary.wiley.com/store/10.1002/ecy.1783/asset/supinfo/ecy1783-sup-0002-DataS1.zip?v=1&s=361647dd673d04c9b0838931cda1cf28e1f6eb1f" -o "C:\Users\mbiber\AppData\Local\Temp\Rtmpeqp8uM\file2d408834de7.zip"' had status 127
Removing the method="curl" argument I can download the file, but than run into problems unzipping the file.
download.file("http://onlinelibrary.wiley.com/store/10.1002/ecy.1783/asset/supinfo/ecy1783-sup-0002-DataS1.zip?v=1&s=361647dd673d04c9b0838931cda1cf28e1f6eb1f", temp, quiet = TRUE)
unzip(temp, files = "Measurements of passerine birds.xlsx", exdir = ".")
Warning message: In unzip(temp, files = "Measurements of passerine birds.xlsx", exdir = ".") : requested file not found in the zip file
When removing the files argument, I still end up with an error:
unzip(temp, exdir = ".")
Warning message: In unzip(temp, exdir = ".") : internal error in 'unz' code
I have tried to manually unzip the file that I downloaded with the adapted code, but the file seems to be corrupted. So I guess the problem is still the file download from within R.
Okay. This should be solved with newest commit, which includes a dependency on package curl
. Could you please try again.
The same problem still occurs.
Okay.
Malte confirms the curl problem. The download.file()
function uses different methods in windows and linux, and windows may use a range of download tools, that are non-standard and not automatically installed. However, I need to write this platform independent. Let's try the 'auto' method. Could you please both test the following:
temp <- tempfile(fileext = ".zip")
download.file("http://onlinelibrary.wiley.com/store/10.1002/ecy.1783/asset/supinfo/ecy1783-sup-0002-DataS1.zip?v=1&s=361647dd673d04c9b0838931cda1cf28e1f6eb1f", temp, method = "auto", quiet = TRUE, mode="wb")
unzip(temp, files = "Measurements of passerine birds.xlsx", exdir = ".")
unlink(temp)
passerines <- readxl::read_xlsx("Measurements of passerine birds.xlsx", sheet = 1)
file.remove("Measurements of passerine birds.xlsx")
That seems to work for me.
That seems to work for me as well. ;)
Thanks for the testing. I just pushed the changes to Github. Please try if the installation works now!
When I try to install the package on Windows, I get the following error message:
Warnung: Ausführung von Kommando 'curl -s -S "http://onlinelibrary.wiley.com/store/10.1002/ecy.1783/asset/supinfo/ecy1783-sup-0002-DataS1.zip?v=1&s=361647dd673d04c9b0838931cda1cf28e1f6eb1f" -o "C:\Users\mbiber\AppData\Local\Temp\RtmpkNdjTP\file2b702e22858.zip"' ergab Status 127 Error in download.file("http://onlinelibrary.wiley.com/store/10.1002/ecy.1783/asset/supinfo/ecy1783-sup-0002-DataS1.zip?v=1&s=361647dd673d04c9b0838931cda1cf28e1f6eb1f", : 'curl' call had nonzero exit status Error : unable to load R code in package 'traitdataform' ERROR: lazy loading failed for package 'traitdataform' removing 'C:/Users/mbiber/Documents/R/win-library/3.4/traitdataform' Installation failed: Command failed (1)
Cheers,
Matthias