View source: R/update_Citavi_ctv6.R
update_Citavi_ctv6 | R Documentation |
Write into Citavi database (via SQL update query)
update_Citavi_ctv6( CitDat = NULL, path = NULL, CitDBTableName = NULL, CitDatVarToCitDBTableVar = NULL, quiet = TRUE )
CitDat |
A table (likely originally read via |
path |
Path to the local Citavi project file (.ctv6, i.e. |
CitDBTableName |
Name of the table from the connected Citavi database to be updated. |
CitDatVarToCitDBTableVar |
Names of Citavi fields to be updated for all references
in the Citavi project. Such a name must be both: (i) a column name in |
quiet |
If |
The underlying core functions are DBI::dbConnect()
RSQLite::SQLite()
and DBI::dbSendQuery()
.
library(dplyr, warn.conflicts = FALSE) # use this package's example Citavi project example_path <- example_file("3dupsin5refs/3dupsin5refs.ctv6") CitDat <- read_Citavi_ctv6(example_path) # looks like this CitDat %>% select(StaticIDs, Title, Year) # let's set all years to 1990 CitDat %>% mutate(AlteredYear = "1990") %>% update_Citavi_ctv6( path = example_path, CitDBTableName = "Reference", CitDatVarToCitDBTableVar = c("AlteredYear" = "Year"), quiet = FALSE ) # it worked! read_Citavi_ctv6(example_path) %>% select(StaticIDs, Title, Year) # we should change it back CitDat %>% mutate(OriginalYear = c("2018", "2019", "2019", "2019", "2019")) %>% update_Citavi_ctv6( path = example_path, CitDBTableName = "Reference", CitDatVarToCitDBTableVar = c("OriginalYear" = "Year"), quiet = FALSE ) # it worked! read_Citavi_ctv6(example_path) %>% select(StaticIDs, Title, Year)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.