From eb559289a4071e7caafe74c8878e21d1143303f0 Mon Sep 17 00:00:00 2001 From: Karim-Mane Date: Sun, 10 Sep 2023 08:18:31 +0000 Subject: [PATCH] fix-issue-16 --- README.Rmd | 12 ++++---- README.md | 12 ++++---- vignettes/readepi.Rmd | 64 +++++++++++++++++++++---------------------- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/README.Rmd b/README.Rmd index 55fb4910..d2d5dc1b 100644 --- a/README.Rmd +++ b/README.Rmd @@ -72,12 +72,12 @@ show_example_file() credentials_file <- system.file("extdata", "test.ini", package = "readepi") # READING FILE FROM A PROJECT IN A REDCap DATABASE -data <- readepi( +dat <- readepi( data_source = "https://bbmc.ouhsc.edu/redcap/api/", credentials_file = credentials_file ) -project_data <- data$data # accessing the actual data -project_metadeta <- data$metadata # accessing the metadata associated with project +project_data <- dat$data # accessing the actual data +project_metadeta <- dat$metadata # accessing the metadata associated with project # VIEWING THE LIST OF ALL TABLES IN A MySQL DATABASE show_tables( @@ -95,7 +95,7 @@ visualise_table( ) # READING ALL FILEDS AND RECORDS FROM A MySQL SERVER -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "author", # this is the table name @@ -103,7 +103,7 @@ data <- readepi( ) # READING DATA FROM DHIS2 -data <- readepi( +dat <- readepi( data_source = "https://play.dhis2.org/dev", credentials_file = credentials_file, dataset = "pBOMPrpg1QX", @@ -114,7 +114,7 @@ data <- readepi( ) # READING DATA FROM THE FINGERTIPS REPOSITORY -data <- readepi( +dat <- readepi( indicator_id = 90362, area_type_id = 202, parent_area_type_id = 6 # optional diff --git a/README.md b/README.md index 0988f8f2..b7100c43 100644 --- a/README.md +++ b/README.md @@ -91,12 +91,12 @@ show_example_file() credentials_file <- system.file("extdata", "test.ini", package = "readepi") # READING FILE FROM A PROJECT IN A REDCap DATABASE -data <- readepi( +dat <- readepi( data_source = "https://bbmc.ouhsc.edu/redcap/api/", credentials_file = credentials_file ) -project_data <- data$data # accessing the actual data -project_metadeta <- data$metadata # accessing the metadata associated with project +project_data <- dat$data # accessing the actual data +project_metadeta <- dat$metadata # accessing the metadata associated with project # VIEWING THE LIST OF ALL TABLES IN A MySQL DATABASE show_tables( @@ -114,7 +114,7 @@ visualise_table( ) # READING ALL FILEDS AND RECORDS FROM A MySQL SERVER -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "author", # this is the table name @@ -122,7 +122,7 @@ data <- readepi( ) # READING DATA FROM DHIS2 -data <- readepi( +dat <- readepi( data_source = "https://play.dhis2.org/dev", credentials_file = credentials_file, dataset = "pBOMPrpg1QX", @@ -133,7 +133,7 @@ data <- readepi( ) # READING DATA FROM THE FINGERTIPS REPOSITORY -data <- readepi( +dat <- readepi( indicator_id = 90362, area_type_id = 202, parent_area_type_id = 6 # optional diff --git a/vignettes/readepi.Rmd b/vignettes/readepi.Rmd index f38c0e9a..5da3b21a 100644 --- a/vignettes/readepi.Rmd +++ b/vignettes/readepi.Rmd @@ -183,7 +183,7 @@ visualise_table( ) # READING ALL FIELDS AND ALL RECORDS FROM ONE TABLE (`author`) -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "author", # this is the table name @@ -192,7 +192,7 @@ data <- readepi( # READING SPECIFIED FIELDS AND ALL RECORDS FROM ONE TABLE fields <- "author_id,name,last_name,initials" -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "author", # this is the table name @@ -202,7 +202,7 @@ data <- readepi( # READING SPECIFIED RECORDS AND ALL FIELDS FROM ONE TABLE records <- "1, 34, 15, 70, 118, 20" -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "author", # this is the table name @@ -212,7 +212,7 @@ data <- readepi( ) # READING SPECIFIED FIELDS AND RECORDS ONE THE TABLE -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "author", # this is the table name @@ -224,7 +224,7 @@ data <- readepi( # READING DATA FROM SEVERAL TABLES table_names <- c("author", "family_author") -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = table_names, # this is the table name @@ -239,7 +239,7 @@ fields <- c( # the first string in the field vector corresponds to the name of the # columns of interest from the first table specified in the `table_names` # argument and so on... -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = table_names, # this is the table name @@ -256,7 +256,7 @@ records <- c( # interest from the first table specified in the `table_name` argument and so # on... when the id column is not the first column in a table, # use the `id_position`" -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = table_names, # this is the table name @@ -267,7 +267,7 @@ data <- readepi( # READING DATA FROM SEVERAL TABLES AND SUBSETTING RECORDS AND FIELDS ACROSS # TABLES -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = table_names, # this is the table name @@ -282,7 +282,7 @@ data <- readepi( ```{r eval=FALSE} # SELECT FEW COLUMNS FROM ONE TABLE AND LEFT JOIN WITH ANOTHER TABLE -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "select author.author_id, author.name, @@ -292,7 +292,7 @@ data <- readepi( ) # SELECT ALL DATA FROM THE author TABLE -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "select * from author", @@ -300,7 +300,7 @@ data <- readepi( ) # SELECT FEW COLUMNS FROM THE author TABLE -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "select author_id, name, last_name from author", @@ -308,7 +308,7 @@ data <- readepi( ) # SELECT FEW RECORDS FROM THE author TABLE -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, source = "select * from author where author_id in ('1','20','50')", @@ -316,7 +316,7 @@ data <- readepi( ) # SELECT FEW RECORDS AND FIELDS FROM THE author TABLE -data <- readepi( +dat <- readepi( data_source = "mysql-rfam-public.ebi.ac.uk", credentials_file = credentials_file, from = "select author_id, name, last_name from author where @@ -343,16 +343,16 @@ Both the data and its associated metadata will be returned after a successful im ```{r eval=FALSE} # READING ALL FIELDS AND RECORDS FROM A REDCap PROJECT -data <- readepi( +dat <- readepi( data_source = "https://bbmc.ouhsc.edu/redcap/api/", credentials_file = credentials_file ) -project_data <- data[["data"]] -project_metadeta <- data[["metadata"]] +project_data <- dat[["data"]] +project_metadeta <- dat[["metadata"]] # READING SPECIFIC FIELDS AND ALL RECORDS FROM THE PROJECT fields <- c("record_id", "name_first", "age", "bmi") -data <- readepi( +dat <- readepi( data_source = "https://bbmc.ouhsc.edu/redcap/api/", credentials_file = credentials_file, fields = fields @@ -360,7 +360,7 @@ data <- readepi( # READING SPECIFIC RECORDS AND ALL FIELDS FROM THE PROJECT records <- c("1", "3", "5") -data <- readepi( +dat <- readepi( data_source = "https://bbmc.ouhsc.edu/redcap/api/", credentials_file = credentials_file, records = records, @@ -368,15 +368,15 @@ data <- readepi( ) # READING SPECIFIC RECORDS AND FIELDS FROM THE PROJECT -data <- readepi( +dat <- readepi( data_source = "https://bbmc.ouhsc.edu/redcap/api/", credentials_file = credentials_file, records = records, fields = fields, id_col_name = "record_id" ) -project_data <- data[["data"]] -project_metadeta <- data[["metadata"]] +project_data <- dat[["data"]] +project_metadeta <- dat[["metadata"]] ``` @@ -429,7 +429,7 @@ data_element_groups <- get_dhis2_attributes( ) # READING THE DATASET ID `pBOMPrpg1QX` -data <- readepi( +dat <- readepi( data_source = "https://play.dhis2.org/dev", credentials_file = credentials_file, dataset = "pBOMPrpg1QX", @@ -440,7 +440,7 @@ data <- readepi( ) # READING DATA FROM 2 DATASETS `pBOMPrpg1QX` -data <- readepi( +dat <- readepi( data_source = "https://play.dhis2.org/dev", credentials_file = credentials_file, dataset = "pBOMPrpg1QX,BfMAe6Itzgt", @@ -452,7 +452,7 @@ data <- readepi( # READING SPECIFIC DATA ELEMENTS FROM THE DATASET ID `pBOMPrpg1QX` data_elts <- c("FTRrcoaog83", "eY5ehpbEsB7", "Ix2HsbDMLea") -data <- readepi( +dat <- readepi( data_source = "https://play.dhis2.org/dev", credentials_file = credentials_file, dataset = "pBOMPrpg1QX", @@ -465,7 +465,7 @@ data <- readepi( ) # READING SPECIFIC COLUMNS FROM A DATASET -data <- readepi( +dat <- readepi( data_source = "https://play.dhis2.org/dev", credentials_file = credentials_file, dataset = "pBOMPrpg1QX,BfMAe6Itzgt", @@ -509,37 +509,37 @@ head(metadata[["indicator_ids_names"]]) head(metadata[["area_type"]]) # IMPORTING DATA USING THE INDICATOR ID -data <- readepi( +dat <- readepi( indicator_id = 90362L, area_type_id = 202L ) # IMPORTING DATA USING THE INDICATOR NAME -data <- readepi( +dat <- readepi( indicator_name = "Healthy life expectancy at birth", area_type_id = 202L ) # IMPORTING DATA USING THE DOMAIN NAME -data <- readepi( +dat <- readepi( domain_name = "A. Overarching indicators", area_type_id = 202L ) -data <- readepi( +dat <- readepi( indicator_name = "Healthy life expectancy at birth", area_type_id = 202L, domain_name = "A. Overarching indicators" ) # IMPORTING DATA USING THE PROFILE ID -data <- readepi( +dat <- readepi( profile_id = 19L, area_type_id = 202L ) # IMPORTING DATA FROM SPECIFIC INDICATOR, DOMAIN, PROFILE, AREA TYPE -data <- readepi( +dat <- readepi( indicator_id = 90362L, indicator_name = "Healthy life expectancy at birth", area_type_id = 202L, @@ -555,7 +555,7 @@ data <- readepi( ) # IMPORTING DATA AND SUBSETTING SPECIFIC RECORDS AND FIELDS -data <- readepi( +dat <- readepi( indicator_id = 90362L, area_type_id = 202L, fields = c("IndicatorID", "AreaCode", "Age", "Value"),