-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStats desc liens.R
65 lines (52 loc) · 1.62 KB
/
Stats desc liens.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
rm(list = ls()) #supprimer tous les objets
library(tidyverse)
library(questionr)
library(RPostgres)
library(lubridate)
library(urltools)
library(TraMineR)
library(cluster)
library(seqhandbook)
library(ade4)
library(explor)
library(FactoMineR)
library(factoextra)
library(labelled)
library(openxlsx)
library(openxlsx2)
library(officer)
# Connexion ----
con<-dbConnect(RPostgres::Postgres())
db <- 'SKEPTISCIENCE' #provide the name of your db
host_db <- 'localhost' # server
db_port <- '5433' # port DBA
db_user <- 'postgres' # nom utilisateur
db_password <- 'Maroua1912'
con <- dbConnect(RPostgres::Postgres(), dbname = db, host=host_db, port=db_port, user=db_user, password=db_password)
# Test connexion
dbListTables(con)
### Récupération des données ----
# donnees depuis local w
data_urls <- readxl::read_excel("~/Documents/Pubpeer project/Pubpeer explo/donnees_urls_fin.xlsx")
# stats par annee
theme_gtsummary_language(language = "fr", decimal.mark = ",", big.mark = " ")
#data_urls$publication <- as.character(data_urls$publication)
sect_properties <- prop_section(
page_size = page_size(
orient = "landscape",
width = 8.3, height = 11.7
),
type = "continuous",
page_margins = page_mar()
)
nb_ann_typ <-
data_urls %>% tbl_summary(
include = c(typo),
by = annee,
percent = "column",
sort = list(everything() ~ "frequency")
) %>%
add_overall(last = TRUE, col_label = "**Ensemble** (effectif total: {N})") %>%
as_flex_table() %>%
flextable::save_as_docx(., path = "/Users/maddi/Documents/Pubpeer project/Pubpeer explo/urls_par_annee_type.docx",
pr_section = sect_properties)