Closed maurolepore closed 6 years ago
BTW, when you succeed running data_preparation()
, is that with a fresh session? I'm afraid you may have something loaded in your global environment that I don't.
@ervanSTRI ,
This issue is the priority.
Please help me figure out why data_preparation()
fails to run from a fresh R environment (an R session other than yours). The next step is for you to run data_praparation()
from this rstudio.cloud project. Save a permanent copy so it remains in your rstudio.cloud account:
That project is a clone of AGBfluxes, and the R environment is completely fresh. This means that nothing from your own computer will interfere (e.g. stuff in your .Rprofile or global environment).
From that rstudio.cloud project you can pull and push to GitHub as us usual. You may need to tell git who you are:
git config --global user.name "username"
git config --global user.email "you@example.com"
This should help you find errors that don't show up from your own computer. Fix them if you can, and let me know if you can't.
@ervanSTRI,
When you run data_preparation()
successfully, Did you run it from a fresh session (i.e. after pressing Shift + Control + F10)? I still get the error I show below.
Also, once you get this to work, please share your output (maybe save it in inst/data_preparation-output.Rdata, or write a .csv file in inst/data_preparation-output.csv).
I fixed the problem. For whatever reason, some mandatory data set included in BIOMASS aren't loaded. I add to debug, catch the data and save it into /data. This is tedious and probably not very clean. We might want to explore that to understand what happen and why the external functions do not work. At least, the function now works properly. I noticed another issue: the ggplot (aes) isn't working at last step, despite the fact that "ggplot2" is mentioned in "import" file. In fact, it seems that both packages ("BIOMASS" and "ggplot2" ) fail to be loaded properly. Maybe we declare them again in the main function # @imports ... ???
@ervanSTRI
At least, the function now works properly.
Unfortunately, it doesn't run neither in my computer nor in rstudio.cloud. Please confirm that you are runing the same code (see below), and that your session is fresh -- meaning that:
Finally, once you do this please share your output as I explained in https://github.com/forestgeo/AGBfluxes/issues/20#issuecomment-429180272.
# Document: devtools::document() or (Shift + Control + D)
# Build: devtools::build() or Shift + Control + B)
# Install: devtools::install() or click Install and Restart
# Restart session (Control + Shift + F10)
library(AGBfluxes)
data_preparation(
site = "barro colorado island",
stem = TRUE,
taper_correction = TRUE,
fill_missing = TRUE,
use_palm_allometry = TRUE,
flag_stranglers = TRUE,
dbh_stranglers = 500,
maxrel = 0.2,
output_errors = TRUE,
DATA_path = NULL,
exclude_interval = NULL
)
... ggplot (aes) isn't working at last step, despite the fact that "ggplot2" is mentioned in "import" file.
This is surprising. Unfortunately I can't reproduce this until I get the some output. In the mean time, I'll refer to all functions in ggplot2 explicitely (as ggplot2::function()
). (This will make the code quite messy but I don't worry for now. I'll cleanup once I can test the outputs.) Now I can remove ggplot2 from imports.R.
... it seems that both packages ("BIOMASS" and "ggplot2" ) fail to be loaded properly....For whatever reason, some mandatory data set included in BIOMASS aren't loaded.
I'm exploring BIOMASS
Good news. I found the data in BIOMASS/data on CRAN's GitHub. I document this in data-raw/data-BIOMASS_package.R.
:::
as I show below). This contains the little mess we are doing here. From inside functions, you can refer to datasets directly -- no need to use ::
nor :::
.This ends my cleanup for now. I hope you can make data_preparation()
run and I'll follow from there. A good place to ensure that runs not only for you but for any user is in README.Rmd. If you knit the file and the output shows an error, then something is wrong. Knitr runs a fresh sesison every time you knit. Notice, however, that after you fix the package and re-install it, you may need to Clear Kniter's Cache:
RE: On Thu, Oct 4, 2018 at 8:22 AM Ervan Rutishauser er.rutishauser@gmail.com wrote:
Unfortunately it fails on my end. I tried from the AGBfluxes package itself, and from a new project with just the data (image below). Can you see what I'm doing wrong?