Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
collectr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DREAL Pays de la Loire
Centre de Services de la Donnée
ADL
collectr
Commits
9ba59a90
Commit
9ba59a90
authored
4 months ago
by
ronan.vignard
Browse files
Options
Downloads
Patches
Plain Diff
Ajout du paramètre host et modification de l'exemple pour insert_into_table()
parent
c30f15a1
Branches
Branches containing commit
No related tags found
4 merge requests
!67
Passage en version 0.1.6
,
!66
Intégration de la fonction download_files_from_list()
,
!65
Correction d'un bug + création des tests pour fix_encoding_variable()
,
!64
Création des tests pour insert_into_table()
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vignettes/write-data.Rmd
+22
-17
22 additions, 17 deletions
vignettes/write-data.Rmd
with
22 additions
and
17 deletions
vignettes/write-data.Rmd
+
22
−
17
View file @
9ba59a90
...
...
@@ -59,23 +59,28 @@ archive_table(host = "localhost",
```{r examples-insert_into_table, eval=FALSE}
#' \dontrun{
# Création d'un dataframe à partir d'un fichier XLSX
data_ars_2022 <- collectr::import_xlsx(
filepath = "C:\\TEMP\\Nitrates_2022.xlsx",
sheet = 1,
row = 1)
# Ajout d'un champs de géométrie
data_ars_2022 <- data_ars_2022 |>
dplyr::select(-coord_x,-coord_y) |>
dplyr::mutate(eligible_ades = rep(NA, dplyr::n()))
# Utilisation de la fonction insert_into_table()
insert_into_table(database = "si_eau",
schema = "nitrates",
table = "nitrate_data_analyse_ars_test",
dataframe = data_ars_2022,
role = "admin")
# Créer une dataframe source
source <- data.frame(
id = 6:10,
name = c("Alice", "Bob", "Charlie", "David", "Eve"),
birthdate = c("1990-01-15", "1985-06-22", "1992-09-10", "1988-03-05", "1995-12-30"),
value = rnorm(5)
)
# Créer une table target dans le schéma public de la base collectr
create_dummy(host = "localhost",
database = "collectr",
schema = "public",
table = "target",
pk = "id",
id_range = "1:5",
role = "runner")
# Utilisation de la fonction insert_into_table()
insert_into_table(host = "localhost",
database = "collectr",
schema = "public",
table = "target",
dataframe = source,
role = "runner")
#' }
```
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment