inbo / camtraptor

Camtraptor is an R package to read, explore and visualize Camera Trap Data Packages (Camtrap DP)
https://inbo.github.io/camtraptor/
MIT License
10 stars 2 forks source link

Create `update_deployments()`, `update_media()`, `update_observations()` to update dataframes #248

Closed peterdesmet closed 4 months ago

peterdesmet commented 1 year ago

Suggested in camtraptor July 2023 coding sprint

232 provides convenience functions to retrieve data. The user might want to alter the data (e.g. adding a column, fixing an error) and attach these back to the data package.

df <- observations(package)
# changes to df
update_observations(package, df)
update_package(package, "observations", df) # maybe too verbose
# or
observations(package) <- df # I'm quite a fan of this approach, but might not be intuitive to user
damianooldoni commented 4 months ago

Suggested in camtraptor July 2024 coding sprint

@peterdesmet: Is there a need in camtrapdp to do manipulations as well? It seems in scope with the goal of the package. Similarly to filter() we can then reexport such functionality.

peterdesmet commented 4 months ago

These functions are available already, as accessor functions (e.g. deployments()<-). As mentioned in the function documentation:

deployments<-() is the assignment equivalent. It should only be used within other functions, where the expected data structure can be guaranteed.

It's not great to provide these to users, as it can break the internal logic between the tables, so I would not reexport them in camtraptor.

damianooldoni commented 4 months ago

Of course! we have them already in camtrapdp. So, this issue can be closed as it is not camtraptor related anymore and already solved in camtrapdp actually.