kevinwolz / hisafer

An R toolbox for the Hi-sAFe biophysical agroforestry model
6 stars 4 forks source link

bug? with hisafe_slice #138

Closed mariegosme closed 4 years ago

mariegosme commented 4 years ago

hisafe_slice seems to be broken:

hop<-read_hisafe_example("agroforestry") hisafe_slice(hop=hop, date="1997-06-20") results in the following error: Erreur : Columns 1, 2 must be named. Use .name_repair to specify repair.

I don't know where to specify .name_repair

kevinwolz commented 4 years ago

This error is caused by lines 134 and/or lines 144 of visualize.R (within hisafe_slice()). It seems that at some point between a year ago (when hisafer was built using dplyr version 0.7.4) and now (I currently have dplyr version 0.8.3 loaded), the functionality of tibble::as_tibble() changed and no longer works on objects of class "table" that do not have column names. I have reported this here (https://github.com/tidyverse/tibble/issues/712), but in the meantime have just altered the as_tibble call so it works with this new functionality.

@mariegosme, just curious, what version of dplyr do you have loaded?

mariegosme commented 4 years ago

I had 0.8.3 and as of this morning 0.8.4 (I updated all packages when I was asked when installing the new version of hisafer). But it still doesn't work:

packageVersion("hisafer") [1] ‘1.4.19’ packageVersion("dplyr") [1] ‘0.8.4’ hop<-read_hisafe_example("agroforestry") Reading: agroforestry Profiles: plot, plotDetail, trees, treesDetail, cells, cellsDetail, voxelsMonth, climate, monthCells, annualCells -- reading: plot -- reading: plotDetail -- reading: trees -- reading: treesDetail -- reading: cells -- reading: cellsDetail -- reading: voxelsMonth -- reading: climate -- reading: monthCells -- reading: annualCells> hisafe_slice(hop=hop, date="1997-06-20") Erreur : Columns 1, 2 must be named. Use .name_repair to specify repair. Call rlang::last_error() to see a backtrace

kevinwolz commented 4 years ago

This doesn't make sense. I don't get this error, and you shouldn't either! It's weird that you seem to have the latest version fo hisafer and this is happening. Please try reinstalling hisafer first. If that doesn't fix it, then type "hisafe_slice" in the console (no arguments no parentheses). This will print the source code of the function. Paste that text here.

mariegosme commented 4 years ago

I reinstalled it with devtools::install_github("kevinwolz/hisafer", build_vignettes = TRUE, dependencies = TRUE) And now hisafe_slice works ! (and I have the vignette available within R) Thanks !!!