From R package documentation:
"Both manual and automatic modifications can be done on the same .odb file, but users are strongly recommended to not use the two methods simultaneously. This R package works on a copy of the file made at the odb.open call, and this copy will replace the
original file at the odb.close call, regardless of what happened between the two calls."
This makes sense in many cases but is annoying for data cleaning, when manual edits are needed to be done in LibreOffice base, depending on data quality tests scripted in R. Use case: a user would write R code accessing the data from an odb file (reading only) and, as they find typos or issues in the data, would manually correct these issus in the odb file. When odb.close() is called, these changes get overwritten.
in the package description, at the end of the above warning ("this copy will replace the
original file at the odb.close call, regardless of what happened between the two calls."), inform the user that they can close the connection in R without writing. (I will propose this in a pull request).
make the write argument mandatory in odb.close (either write= T or F, but no default). This would help avoid surprise and data loss (for those users who read only part of the documentation).
for a given connection, keep track of operation types; then, if there is no write operation between odb.open() and odb.close(), choose odb.close(odb, write = FALSE) as default.
Also, note that somehow the documentation for odb.close is misleading at "Closes the connection to the embedded HSQLDB, removing temporary files and updating the .odb file if asked to do so." as it may foul a quick reader into believing this is not the default. (I will propose to fix this in a pull request).
From R package documentation: "Both manual and automatic modifications can be done on the same .odb file, but users are strongly recommended to not use the two methods simultaneously. This R package works on a copy of the file made at the odb.open call, and this copy will replace the original file at the odb.close call, regardless of what happened between the two calls."
This makes sense in many cases but is annoying for data cleaning, when manual edits are needed to be done in LibreOffice base, depending on data quality tests scripted in R. Use case: a user would write R code accessing the data from an odb file (reading only) and, as they find typos or issues in the data, would manually correct these issus in the odb file. When odb.close() is called, these changes get overwritten.
Possible changes (to be discussed):
write
argument mandatory in odb.close (either write= T or F, but no default). This would help avoid surprise and data loss (for those users who read only part of the documentation).odb.close(odb, write = FALSE)
as default.Also, note that somehow the documentation for odb.close is misleading at "Closes the connection to the embedded HSQLDB, removing temporary files and updating the .odb file if asked to do so." as it may foul a quick reader into believing this is not the default. (I will propose to fix this in a pull request).