Skip to content

Commit

Permalink
fix Rdoc, README and vignete for 📦 to CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Dec 15, 2024
1 parent 8d39304 commit 289d569
Show file tree
Hide file tree
Showing 34 changed files with 116 additions and 342 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ Collate:
SDMXRequestBuilder-methods.R SDMXREST20RequestBuilder-methods.R SDMXREST21RequestBuilder-methods.R SDMXDotStatRequestBuilder-methods.R
SDMXServiceProvider-methods.R SDMXServiceProviders-methods.R readSDMX.R saveSDMX.R
profile.R rsdmx.R
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(r6 = FALSE)
153 changes: 23 additions & 130 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,131 +1,24 @@
import("methods")
import("XML")
import("httr")
import("R6")
importFrom("plyr", "rbind.fill")
importFrom("utils", "packageVersion")
# Generated by roxygen2: do not edit by hand

exportClasses(
SDMX,
SDMXSchema,
SDMXHeader,
SDMXFooterMessage,
SDMXFooter,
SDMXType,
SDMXStructureType,
SDMXConcept,
SDMXConceptScheme,
SDMXConcepts,
SDMXCode,
SDMXCodelist,
SDMXCodelists,
SDMXDimension,
SDMXTimeDimension,
SDMXPrimaryMeasure,
SDMXAttribute,
SDMXComponents,
SDMXDataStructure,
SDMXDataStructures,
SDMXDataStructureDefinition,
SDMXItemScheme,
SDMXOrganisationScheme,
SDMXOrganisation,
SDMXAgency,
SDMXAgencyScheme,
SDMXOrganisationSchemes,
SDMXData,
SDMXGenericData,
SDMXCompactData,
SDMXUtilityData,
SDMXStructureSpecificData,
SDMXStructureSpecificTimeSeriesData,
SDMXCrossSectionalData,
SDMXMessageGroup,
SDMXDataFlow,
SDMXDataFlows,
SDMXRequestParams,
SDMXRequestBuilder,
SDMXREST20RequestBuilder,
SDMXREST21RequestBuilder,
SDMXDotStatRequestBuilder,
SDMXServiceProvider,
SDMXServiceProviders
)

export(
rsdmxLogger,
SDMX,
SDMXSchema,
SDMXHeader,
SDMXFooterMessage,
SDMXFooter,
SDMXType,
SDMXStructureType,
SDMXConcept,
SDMXConceptScheme,
SDMXConcepts,
SDMXCode,
SDMXCodelist,
SDMXCodelists,
SDMXDimension,
SDMXTimeDimension,
SDMXPrimaryMeasure,
SDMXAttribute,
SDMXComponents,
SDMXDataStructure,
SDMXDataStructures,
SDMXDataStructureDefinition,
SDMXOrganisation,
SDMXAgency,
SDMXAgencyScheme,
SDMXOrganisationSchemes,
SDMXGenericData,
SDMXCompactData,
SDMXUtilityData,
SDMXStructureSpecificData,
SDMXCrossSectionalData,
SDMXMessageGroup,
SDMXData,
SDMXDataFlow,
SDMXDataFlows,
SDMXRequestParams,
SDMXRequestBuilder,
SDMXREST20RequestBuilder,
SDMXREST21RequestBuilder,
SDMXDotStatRequestBuilder,
SDMXServiceProvider,
SDMXServiceProviders,
namespaces.SDMX,
findNamespace,
isSoapRequestEnvelope,
getSoapRequestResult,
isRegistryInterfaceEnvelope,
getRegistryInterfaceResult,
addSDMXServiceProvider,
findSDMXServiceProvider,
setSDMXServiceProviders,
getSDMXServiceProviders,
readSDMX,
saveSDMX
)

exportMethods(
getStructureType,
getNamespaces,
setDSD
)

S3method(as.data.frame, SDMXGenericData)
S3method(as.data.frame, SDMXCompactData)
S3method(as.data.frame, SDMXUtilityData)
S3method(as.data.frame, SDMXStructureSpecificData)
S3method(as.data.frame, SDMXStructureSpecificTimeSeriesData)
S3method(as.data.frame, SDMXCrossSectionalData)
S3method(as.data.frame, SDMXMessageGroup)
S3method(as.data.frame, SDMXConcepts)
S3method(as.data.frame, SDMXCodelists)
S3method(as.data.frame, SDMXDataStructures)
S3method(as.data.frame, SDMXOrganisationSchemes)
S3method(as.data.frame, SDMXComponents)
S3method(as.data.frame, SDMXDataFlows)
S3method(as.data.frame, SDMXServiceProviders)
S3method(as.data.frame,SDMXCodelists)
S3method(as.data.frame,SDMXCompactData)
S3method(as.data.frame,SDMXComponents)
S3method(as.data.frame,SDMXConcepts)
S3method(as.data.frame,SDMXCrossSectionalData)
S3method(as.data.frame,SDMXDataFlows)
S3method(as.data.frame,SDMXDataStructures)
S3method(as.data.frame,SDMXGenericData)
S3method(as.data.frame,SDMXMessageGroup)
S3method(as.data.frame,SDMXOrganisationSchemes)
S3method(as.data.frame,SDMXServiceProviders)
S3method(as.data.frame,SDMXStructureSpecificData)
S3method(as.data.frame,SDMXStructureSpecificTimeSeriesData)
S3method(as.data.frame,SDMXUtilityData)
export(getStructureType)
export(rsdmxLogger)
import(R6)
import(XML)
import(httr)
import(methods)
import(plyr)
import(utils)
8 changes: 4 additions & 4 deletions R/SDMX-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ encodeSDMXOutput <- function(df){

#' @name getNamespaces
#' @docType methods
#' @rdname SDMXStructureType-methods
#' @aliases getNamespaces,SDMX-method
#' @title getNamespaces
#' @description Access the namespaces of the SDMX-ML object
Expand All @@ -76,11 +77,10 @@ encodeSDMXOutput <- function(df){
#' @seealso \link{SDMX-class}
#'
#' @author Emmanuel Blondel, \email{emmanuel.blondel1@@gmail.com}
setGeneric("getNamespaces", function(obj) standardGeneric("getNamespaces"));

if (!isGeneric("getNamespaces"))
setGeneric("getNamespaces", function(obj) standardGeneric("getNamespaces"));

#' @describeIn getNamespaces Access the namespaces of the SDMX-ML object
#' @rdname SDMXStructureType-methods
#' @aliases getNamespaces,SDMX,ANY-method
setMethod(f = "getNamespaces", signature = "SDMX", function(obj){
return(namespaces.SDMX(obj@xmlObj));
})
Expand Down
1 change: 1 addition & 0 deletions R/SDMXCodelists-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ codelists.SDMXCodelists <- function(xmlObj, namespaces){

#as.data.frame
#=============
#'@export
as.data.frame.SDMXCodelists <- function(x, ...,
codelistId = NULL,
ignore.empty.slots = TRUE){
Expand Down
2 changes: 1 addition & 1 deletion R/SDMXCompactData-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ getSDMXAllCompactData <- function(x, nsExpr, labels = FALSE, ...) {
return(encodeSDMXOutput(dataset))
}


#'@export
as.data.frame.SDMXCompactData <- function(x, row.names=NULL, optional=FALSE,
labels = FALSE, ...){
return(getSDMXAllCompactData(x, nsExpr = "compact", labels = labels));
Expand Down
1 change: 1 addition & 0 deletions R/SDMXComponents-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ attributes.SDMXComponents <- function(xmlObj, namespaces){
}

#methods
#'@export
as.data.frame.SDMXComponents <- function(x, ...){

#dimensions
Expand Down
1 change: 1 addition & 0 deletions R/SDMXConcepts-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ conceptSchemes.SDMXConcepts <- function(xmlObj, namespaces){

#as.data.frame
#=============
#'@export
as.data.frame.SDMXConcepts <- function(x, ...,
conceptSchemeId = NULL,
ignore.empty.slots = TRUE){
Expand Down
2 changes: 1 addition & 1 deletion R/SDMXCrossSectionalData-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SDMXCrossSectionalData <- function(xmlObj, namespaces){

#methods
#=======

#'@export
as.data.frame.SDMXCrossSectionalData <- function(x, row.names=NULL, optional=FALSE,
labels = FALSE, ...){

Expand Down
8 changes: 4 additions & 4 deletions R/SDMXData-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ addLabels.SDMXData <- function(data, dsd){

#' @name setDSD
#' @docType methods
#' @rdname SDMXData-method
#' @aliases setDSD,SDMXData-method
#' @title setDSD
#' @description set the 'dsd' slot of a \code{SDMXData} object
Expand All @@ -136,11 +137,10 @@ addLabels.SDMXData <- function(data, dsd){
#' @seealso \link{SDMXData-class}
#'
#' @author Emmanuel Blondel, \email{emmanuel.blondel1@@gmail.com}
setGeneric("setDSD", function(obj, dsd) standardGeneric("setDSD"));

if (!isGeneric("setDSD"))
setGeneric("setDSD", function(obj, dsd) standardGeneric("setDSD"));

#' @describeIn setDSD set the 'dsd' slot of a \code{SDMXData} object
#' @rdname SDMXStructureType-methods
#' @aliases setDSD,SDMXData,ANY-method
setMethod(f = "setDSD", signature = "SDMXData", function(obj, dsd){
slot(obj, "dsd") <- dsd
return(obj)
Expand Down
1 change: 1 addition & 0 deletions R/SDMXDataFlows-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ dataflows.SDMXDataFlows <- function(xmlObj, namespaces){
}

#methods
#'@export
as.data.frame.SDMXDataFlows <- function(x, ...){

out <- do.call("rbind.fill",
Expand Down
1 change: 1 addition & 0 deletions R/SDMXDataStructures-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ datastructures.SDMXDataStructures <- function(xmlObj, namespaces){
}

#methods
#'@export
as.data.frame.SDMXDataStructures <- function(x, ...){

out <- do.call("rbind.fill",
Expand Down
6 changes: 3 additions & 3 deletions R/SDMXDotStatRequestBuilder-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SDMXDotStatRequestBuilder <- function(regUrl, repoUrl, accessKey = NULL,
#resource handler
handler <- list(

#'dataflow' resource (path="GetKeyFamily/{resourceID}")
#dataflow resource (path="GetKeyFamily/resourceID")
#------------------------------------------------------
dataflow = function(obj){
if(is.null(obj@resourceId)) obj@resourceId = "ALL"
Expand All @@ -62,7 +62,7 @@ SDMXDotStatRequestBuilder <- function(regUrl, repoUrl, accessKey = NULL,
return(req)
},

#'datastructure' resource (path="GetDataStructure/{resourceID}/{agencyID}")
#datastructure resource (path="GetDataStructure/resourceID/agencyID")
#--------------------------------------------------------------------------
datastructure = function(obj){
if(is.null(obj@resourceId)) obj@resourceId = "all"
Expand All @@ -83,7 +83,7 @@ SDMXDotStatRequestBuilder <- function(regUrl, repoUrl, accessKey = NULL,
return(req)
},

#'data' resource (path="GetData/{flowRef}/{key}/{agencyId}")
#data resource (path="GetData/flowRef/key/agencyId")
#----------------------------------------------------------
data = function(obj){
if(is.null(obj@flowRef)) stop("Missing flowRef value")
Expand Down
1 change: 1 addition & 0 deletions R/SDMXGenericData-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ SDMXGenericData <- function(xmlObj, namespaces){
}

#methods
#'@export
as.data.frame.SDMXGenericData <- function(x, row.names=NULL, optional=FALSE,
labels = FALSE, ...){
xmlObj <- x@xmlObj;
Expand Down
1 change: 1 addition & 0 deletions R/SDMXMessageGroup-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class.SDMXMessageGroup <- function(xmlObj){

}

#'@export
as.data.frame.SDMXMessageGroup <- function(x, row.names=NULL, optional=FALSE,
labels = FALSE, ...){
#TODO support for other included message types
Expand Down
1 change: 1 addition & 0 deletions R/SDMXOrganisationSchemes-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ organisationSchemes.SDMXOrganisationSchemes <- function(xmlObj, namespaces){
}

#methods
#'@export
as.data.frame.SDMXOrganisationSchemes <- function(x, ...){

out <- do.call("rbind.fill",
Expand Down
18 changes: 9 additions & 9 deletions R/SDMXServiceProvider-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,15 @@ setSDMXServiceProviders <- function(){ # nocov start
),
handler = list(

#'dataflow' resource (path="dataset/{resourceId}/def.sdmx.xml")
#dataflow resource (path="dataset/resourceId/def.sdmx.xml")
#-----------------------------------------------------------------------
dataflow = function(obj){
req <- sprintf("%s/dataset", obj@regUrl)
if(!is.null(obj@resourceId)) req <- paste(req, obj@resourceId, sep="/")
req <- paste(req, "def.sdmx.xml", sep="/")
return(req)
},
#'datastructure' resource (path="dataset/{resourceID}.structure.sdmx.xml")
#datastructure resource (path="dataset/resourceID.structure.sdmx.xml")
#-----------------------------------------------------------------------
datastructure = function(obj){
req <- sprintf("%s/dataset", obj@regUrl)
Expand All @@ -354,7 +354,7 @@ setSDMXServiceProviders <- function(){ # nocov start
req <- paste0(req, ".structure.sdmx.xml")
return(req)
},
#'data' resource (path="dataset/{resourceID}.generic.sdmx.xml")
#data resource (path="dataset/resourceID.generic.sdmx.xml")
#----------------------------------------------------------
data = function(obj){
req <- sprintf("%s/dataset", obj@repoUrl)
Expand Down Expand Up @@ -393,18 +393,18 @@ setSDMXServiceProviders <- function(){ # nocov start
),
handler = list(

#'dataflow' resource (path="/")
#dataflow resource (path="/")
#-----------------------------------------------------------------------
dataflow = function(obj){
return(obj@regUrl)
},
#'datastructure' resource (path="/{resourceID})
#datastructure resource (path="/resourceID)
#-----------------------------------------------------------------------
datastructure = function(obj){
req <- paste(obj@regUrl, obj@resourceId, sep = "/")
return(req)
},
#'data' resource (path="getdata?dataflow={flowRef}&key={key})
#data resource (path="getdata?dataflow=flowRef&key=key)
#----------------------------------------------------------
data = function(obj){
if(is.null(obj@flowRef)) stop("Missing flowRef value")
Expand Down Expand Up @@ -520,18 +520,18 @@ setSDMXServiceProviders <- function(){ # nocov start
),
handler = list(

#'dataflow' resource (path="/")
#dataflow resource (path="/")
#-----------------------------------------------------------------------
dataflow = function(obj){
return(obj@regUrl)
},
#'datastructure' resource (path="/{resourceID})
#datastructure resource (path="/resourceID)
#-----------------------------------------------------------------------
datastructure = function(obj){
req <- paste(obj@regUrl, obj@resourceId, sep = "/")
return(req)
},
#'data' resource (path="getdata?dataflow={flowRef}&key={key})
#data resource (path="getdata?dataflow=flowRef&key=key)
#----------------------------------------------------------
data = function(obj){
if(is.null(obj@flowRef)) stop("Missing flowRef value")
Expand Down
1 change: 1 addition & 0 deletions R/SDMXServiceProviders-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SDMXServiceProviders <- function(providers) {
new("SDMXServiceProviders", providers = providers);
}

#'@export
as.data.frame.SDMXServiceProviders <- function(x, ...){
out <- as.data.frame(do.call("rbind",
lapply(slot(x, "providers"),
Expand Down
Loading

0 comments on commit 289d569

Please sign in to comment.