GioBo / TR8

R package for downloading functional traits data for plant species
20 stars 7 forks source link

Error with TR8 function. #35

Closed paternogbc closed 7 years ago

paternogbc commented 8 years ago

I am getting this error when trying to run this command: my_traits <- c("sex_reprod_fr") retrieved_traits <- tr8(species_list = species_names, download_list = my_traits)

Content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' length 3929234 bytes (3.7 MB) downloaded 3.7 MB

Wide character in print at /home/paterno/R/x86_64-pc-linux-gnu-library/3.2/gdata/perl/xls2tab.pl line 327. Wide character in print at /home/paterno/R/x86_64-pc-linux-gnu-library/3.2/gdata/perl/xls2tab.pl line 327. Error in [.data.frame(catminat_df, , selected_columns_catminat) : undefined columns selected Além disso: Warning messages: 1: In read.table(file = file, header = header, sep = sep, quote = quote, : entrada inválida na conexão de entrada '/tmp/RtmpQ6zTJz/file1657500b7cb9.tab' 2: In read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on '/tmp/RtmpQ6zTJz/file1657500b7cb9.tab'

IF you need more details or a full reproducible example, please let me know.

best

GioBo commented 8 years ago

Hi, As far as i can understand this problem is not due to R (or TR8) but to perl: the Catminat dataset is an excel file and TR8 relies on the "gdata" package in order to read that; gdata uses perl to read xls files and in this case the encoding of characters inside Catminat is causing problems to perl (please have a look at https://stat.ethz.ch/pipermail/r-help//2013-February/346772.html for a similar problem). I will try to switch from gdata to Hadley's "readxl" package (which does not need any external software to read excel files). Hope to fix this bug soon....I'll let you know when it's working again. Thanks for reporting the bug,

G.

paternogbc commented 8 years ago

I see. I think you are correct. The "readxl" package is very good and stable. It might be a good deal to change your code, plus you reduce dependencies.

All the best, G

PhillRob commented 8 years ago

I encountered the same problem and found the source spreadsheet here (http://philippe.julve.pagesperso-orange.fr/catminat.htm) to compile data through xls via vlookup function. Cheers, P

GioBo commented 8 years ago

The package is now using "readxl"; I've tested it on linux and it's working properly; could you please try the devel version here on GH (master branch) and let me know if it's working fine for you or not? If so, I'll upload it on CRAN.

G.

paternogbc commented 8 years ago

@GioBo thanks for that! I will try that and give you a feedback.

All the best, G

paternogbc commented 8 years ago

Dear @GioBo,

I am sorry for my late reply, I was involved in a course during the last weeks. I have now installed TR8 dev version in my computer and the code

my_traits <- c("sex_reprod_fr")
retrieved_traits <- tr8(species_list = "Abies alba", download_list = my_traits)

runs without any error!

Thanks a lot for the fix.

Cheers, G

gazzapol commented 7 years ago

Dear @GioBo,

I am trying to use tr8 function but when selecting traits as the following ones "flower_colour_fr","ell_L_fr","elle_T_fr","ell_C_fr","ell_U_atm_fr","ell_U_fr","ell_R_fr","ell_N_fr","ell_S_fr", "Soil_texture_fr","organic_matter_fr"

I get this error message

trying URL 'http://philippe.julve.pagesperso-orange.fr/baseflor.xlsx' Content type 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' length 3929234 bytes (3.7 MB) downloaded 3.7 MB

Error in value[[jvseq[[jjj]]]] : subscript out of bounds In addition: Warning messages: 1: Unknown column 'rang_taxinomiqu' 2: In matrix(value, n, p) : data length exceeds size of matrix

any idea how to solve this?

PS: connection to LEDA seems to be not working in this function as I got also (on other traits) LEDA website is probably down. Please re-run tr8() without selecting LEDA as a source of data (or re-try later).

GioBo commented 7 years ago

Thanks @gazzapol for reporting the issues:

  1. I cannot reproduce the bug about "french" traits (from the Catminat database); can you provide some info about the operating system you are using? I am expecting some problems related to Windows, but this is weird...

    1. Yes, LEDA data could not be retrieved because URL of the database has recently changed (hadn't noticed that): I've updated the @package; could you please try the devel version of the package as described at https://github.com/GioBo/TR8?

      Best

GioBo.

gazzapol commented 7 years ago

Dear @GioBo, I am using Windows 10 and the updated version of R 3.4.1

my_species_prova <- c("Populus alba","Populus nigra", "Rumex sanguineus","Humulus lupulus") my_traits_prova<-c("h_max","le_area","li_form_B","strategy", "inflorescence_fr")

retrieved_traits_prova<-tr8(species_list = my_species_prova,download_list = my_traits_prova,synonyms=T, catminat_alternatives=T)

ciao

PS: LEDA seems working with devel version , thanks

GioBo commented 7 years ago

Dear @gazzapol,

I've updated the package on Github: could you please try the devel version and see whether you still face the problem? Best,

G.

gazzapol commented 7 years ago

Dear @GioBo,

thanks, it work well now, no errors shown

best